Giter Site home page Giter Site logo

Comments (7)

skvark avatar skvark commented on May 17, 2024 3

You can try pip install --user opencv-python or use virtualenvs. And you are correct, sudo should not be used to install packages with pip.

However, the root of this issue lies in MacOS or in how some of its package managers handle Python installations. I'm not too famialiar with all the MacOS weirdness, but the data_files parameter in setup.py uses relative paths so distutils behaves just like documented. If I move the licenses to a subfolder in this package, the issue stays the same. Even if there are no data_files, the problem would still most likely persist.

I have no access to a Mac currently, but this should be pretty easy to test with a dummy package. Moving the licenses to package_data in setup.py could also help if the issue is related only to the data_files.

from opencv-python.

impact27 avatar impact27 commented on May 17, 2024

This might be of interest:
https://stackoverflow.com/questions/43800753/pip-tries-to-install-package-in-the-wrong-location

from opencv-python.

impact27 avatar impact27 commented on May 17, 2024

In would think that the licenses should be package_data. from installing-package-data:

These files are often data that’s closely related to the package’s implementation

data_files is used for a general purpose. It can be install pretty much wherever installing-additional-files:

If directory is a relative path, it is interpreted relative to the installation prefix

The installation prefix here is /usr/local, which is probably not where the license should be saved.
I will admit I do not fully understand what the target directory is:

You can specify the data_files options as a simple sequence of files without specifying a target directory, but this is not recommended, and the install command will print a warning in this case. To install data files directly in the target directory, an empty string should be given as the directory.

But this issue can probably be solve by using package_data instead of data_files.

from opencv-python.

skvark avatar skvark commented on May 17, 2024

Yes, I agree that moving the files into package_data might help. Feel free to open pull request.

Note that the Travis builds are currently broken (I don't know yet why) but I'm going try to fix the issue asap since OpenCV 3.3.0 release is getting closer.

from opencv-python.

impact27 avatar impact27 commented on May 17, 2024

I am not sure where to include them. Should the files be installed in the cv2 folder?
A bit more insight: pypa/pip#2874 (comment)

from opencv-python.

skvark avatar skvark commented on May 17, 2024

I'm not sure either, but I would like to keep the license files in the root of this project so that they can be found easily. I would have used MANIFEST.in to collect the additional data files but it's not supported in binary wheels. Some options:

Option 1

Add

[metadata]
license_file = <license filename>

to setup.cfg. This requires that all the licenses are moved into a single file. See: https://bitbucket.org/pypa/wheel/issues/138/include-more-than-one-license-file-or

Option 2

Copy the license files during build to cv2 folder and include them there with package_data. This is probably better because the licenses can be kept separated.

Please comment if you have any better ideas. For some reason Python's packaging tools make these simple looking things unbelievably complex.

from opencv-python.

glitchassassin avatar glitchassassin commented on May 17, 2024

Submitted a pull request for package_data.

from opencv-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.