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)
- PyPI: macOS arm64 wheel missing
- cv2.createThinPlateSplineShapeTransformer not exist in 4.10
- imdecode jpeg2000 segfault or deadlock in multithreading HOT 2
- Typing of compare does not allow scalar for src1 or src2
- Why Building wheel for opencv-python when using "pip install opencv-python"
- Typing stubs generation has failed when building wheel HOT 1
- error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:396: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'
- Gstreamer support on windows 10
- why ı am getting this error
- BUG: cv2.fillPoly() causing segmentation fault on Ubuntu 22.04.4 LTS HOT 1
- [Suggestion] Metapackage as solution to current issues with opencv as dependency HOT 1
- Build from source python 3.12 fails HOT 6
- error: OpenCV(4.8.0) /io/opencv/modules/core/src/copy.cpp:71: error: (-215:Assertion failed) cn <= 4 in function 'scalarToRawData'
- ModuleNotFoundError: No module named 'distutils' in latest release HOT 7
- MacOS arm64 wheels missing from PyPI 4.10 release HOT 2
- ImportError: numpy.core.multiarray --- Numpy 2.0.0 HOT 1
- cv2/cv2.abi3.so, 2): Library not loaded: /usr/local/opt/libunistring/lib/libunistring.2.dylib Referenced from: /usr/local/opt/gnutls/lib/libgnutls.30.dylib HOT 1
- When will opencv-python support numpy 2.0? HOT 6
- compile bug
- AttributeError: module 'numpy' has no attribute 'object'. `np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe. HOT 1
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.