Comments (7)
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.
This might be of interest:
https://stackoverflow.com/questions/43800753/pip-tries-to-install-package-in-the-wrong-location
from opencv-python.
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.
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.
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.
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.
Submitted a pull request for package_data.
from opencv-python.
Related Issues (20)
- Error Running OpenCV on Android aarch64 A14
- Exception: Not found: 'python/cv2/py.typed' ERROR: Failed building wheel for opencv-python in Anaconda Python 3.6 HOT 1
- cv2.findEssentialMat() Error with 2 cameraMatrix HOT 2
- closed HOT 1
- Uninstalling opencv-python prevents opencv-contrib-python from working.
- A error with using cv2.cvtColor to convert BGR img to HSV
- IndexError: invalid index to scalar variable.
- CMake Error: CMake was unable to find a build program corresponding to "Ninja"
- MacOS: pylint confuses the type of cv2.error HOT 2
- OpenCV feed keeps getting crash
- The imread function for reading images and the imshow function for setting image titles should support Chinese characters
- TypeError: 'numpy._DTypeMeta' object is not subscriptable HOT 1
- Functions missing from aruco module
- Gpu memory increase while using cv2.rectangle
- error when compile debug opencv-python
- Run cv2 window in fullscreen automatically
- Update dependent numpy version from 1.21.4 -> 1.26.4
- ImportError: DLL load failed while importing cv2: The specified module could not be found. HOT 1
- ImportError: DLL load failed while importing cv2
- I have a problem installing opencv python==4.5.3.56 ,I want the same version to be compatible with my project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv-python.