Comments (11)
setup.py
should work now with sdist
. I spent some time refactoring it and making it compatible with pip wheel
command. The build dependencies can be now defined in pyproject.toml
so there are no side effects related to those dependencies. However, for example scikit-build
does not currently implement PEP 517 (scikit-build/scikit-build#124) so there are still many things which need to be fixed in the future when the Python packaging tools get better.
Source distributions will be in PyPI in next release. From now on, local builds shoud be done with pip wheel
command. There's more guidance in the readme file.
from opencv-python.
@tedski #362 has to be fixed before any new releases are pushed to PyPI.
from opencv-python.
Not publishing an sdist on PyPI could also prevent it from being included in various Linux distros.
from opencv-python.
I understand that an sdist is needed to enable source builds. This project was originally created to provide a very easy way to install OpenCV as a pre-built package. All the build scripts are targeted directly for CI services (Travis, Appveyor). They are decoupled from setup.py
which means that with the current project structure there's no point to push sdist to PyPI because setup.py install
won't simply work as it's supposed to work.
It's certainly possible to publish an sdist in the future, but it requires major changes to the build logic and it's really hard to say how much work it would need to make sdist happen.
You can install the current pre-built packages to any glibc based Linux distro with pip. Including this distribution in Linux distros is not a priority.
from opencv-python.
I took a look at the setup, and I see it's not easy indeed.
Would be an awesome addition though :)
from opencv-python.
I looked into this. It would require to override generate_source_manifest
(subcommand of sdist
).
- would override
skbuild.command.generate_source_manifest
- in repo checkout
- writes custom envvars into files
- adds
opencv/*
,opencv_contrib/*
if needed, custom envvars files, OpenCV version file to the list of files to package
- in repo checkout
- OpenCV version detection logic also needs to be tweaked to unconditionally use the prerecorded file if not in repo checkout
The idea is to save all data derived from custom envvars and Git metadata (including a snapshot of the submodules needed) and include it into the sdist tarball -- so that sdist will be built with setup.py build
in the same configuration as it was created in.
from opencv-python.
python setup.py sdist
runs fine currently and produces an archive (including the correct snapshot of the OpenCV submodules), but trying to install it produces errors because the archive is not a Git repo and therefore the correct version (Git tag) cannot be determined (find_version.py
fails). So yes, the version and other possible needed variables should be written to file and read from there in the case of source distribution install.
from opencv-python.
Not sure if it would indeed help here or not (since this is a quite advanced setup.py
), but with setupmeta I definitely dealt with precisely this case.
You can take a look in case it applies to you:
- https://github.com/zsimic/setupmeta
- versioning doc: https://github.com/zsimic/setupmeta/blob/master/docs/versioning.rst
In your case, you would use the "advanced" section of the versioning doc linked above, provide a function for main
that returns the opencv version (no need to store it anywhere), and extra
would be another function that computes your 4th component...
However, after looking into setup.py
, and trying to simply run setup.py --name
, I realized it's full of side effects: it installed numpy
and scikit-build
into my clean python installation (!)... had to re-install it to get it clean again.
So, wanted to chime in to say I solved the exact same problem: determine version from git tags, yet find a way to make it work without git repo as well. It's very doable, you just need to find version from packaging metadata when there is no .git folder basically...
from opencv-python.
I think long term you'll be better off if you can manage to write setup.py
without any on-the-fly installations, ie get rid of get_or_install()
, import skbuild
, don't run pip install
(!) etc
from opencv-python.
Do you have an ETA on the next release that will push source distributions to PyPI?
from opencv-python.
Source distributions will be up in PyPI in the next 24 hours.
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.