Installation error
Hi, I'm running Python 3.11.5. I am running a 2023 Macbook Pro; hence, I am using the arm64 version of Python (for the M1 or M2 chips), and not the x86_64 version of Python (for an Intel chip). The command pip install cnvkit gave the following error message below. Do you have any advice? Thank you.
⇒ pip install cnvkit
Collecting cnvkit
Using cached CNVkit-0.9.11.tar.gz (176 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting biopython>=1.80 (from cnvkit)
Using cached biopython-1.83-cp311-cp311-macosx_11_0_arm64.whl.metadata (13 kB)
Requirement already satisfied: matplotlib>=3.5.2 in ./deactivate/lib/python3.11/site-packages (from cnvkit) (3.9.0)
Requirement already satisfied: numpy>=1.24.2 in ./deactivate/lib/python3.11/site-packages (from cnvkit) (1.26.4)
Requirement already satisfied: pandas>=1.5.3 in ./deactivate/lib/python3.11/site-packages (from cnvkit) (2.2.2)
Collecting pomegranate<=0.14.9,>=0.14.8 (from cnvkit)
Using cached pomegranate-0.14.9.tar.gz (4.7 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [75 lines of output]
Error compiling Cython file:
------------------------------------------------------------
...
cpdef disable_gpu():
global GPU
GPU = False
cdef ndarray_wrap_cpointer(void* data, numpy.npy_intp n):
^
------------------------------------------------------------
pomegranate/utils.pyx:120:5: Function signature does not match previous declaration
Compiling pomegranate/BayesClassifier.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/BayesianNetwork.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/FactorGraph.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/MarkovNetwork.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/NaiveBayes.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/base.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/bayes.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/gmm.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/hmm.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/kmeans.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/scipy/linalg/cython_blas.pxd.
Compiling pomegranate/parallel.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/utils.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/scipy/linalg/cython_blas.pxd.
Compiling pomegranate/distributions/BernoulliDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/BetaDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/ConditionalProbabilityTable.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/DirichletDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/DiscreteDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/ExponentialDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/GammaDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/IndependentComponentsDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/JointProbabilityTable.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/KernelDensities.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/LogNormalDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/MultivariateGaussianDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/scipy/linalg/cython_blas.pxd.
Compiling pomegranate/distributions/NormalDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/PoissonDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/UniformDistribution.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
Compiling pomegranate/distributions/distributions.pyx because it depends on /private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Includes/libc/string.pxd.
[ 1/28] Cythonizing pomegranate/BayesianNetwork.pyx
[ 2/28] Cythonizing pomegranate/MarkovNetwork.pyx
[ 3/28] Cythonizing pomegranate/distributions/ConditionalProbabilityTable.pyx
[ 4/28] Cythonizing pomegranate/distributions/IndependentComponentsDistribution.pyx
[ 5/28] Cythonizing pomegranate/distributions/JointProbabilityTable.pyx
[ 6/28] Cythonizing pomegranate/distributions/MultivariateGaussianDistribution.pyx
[ 7/28] Cythonizing pomegranate/hmm.pyx
[ 8/28] Cythonizing pomegranate/kmeans.pyx
[ 9/28] Cythonizing pomegranate/utils.pyx
Traceback (most recent call last):
File "/Users/miw267/Repos/changepoints/deactivate/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/miw267/Repos/changepoints/deactivate/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/miw267/Repos/changepoints/deactivate/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "/private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 61, in <module>
File "/private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1115, in cythonize
cythonize_one(*args)
File "/private/var/folders/vg/q45k1lj96hzd0qyfkwstbqbr0000gq/T/pip-build-env-fgw3yhvh/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1238, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pomegranate/utils.pyx
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I have the same issue on x86_64.
You may have fixed this but I'll post here for posterity. See https://github.com/jmschrei/pomegranate/issues/1052, https://github.com/jmschrei/pomegranate/issues/1057 for more information about what's going on here.
Long story short is that cnvkit asks for pomegranate 0.14.8 or 0.14.9, but those versions of pomegranate ask for numpy versions >=1.20.0. The issue here is that the numpy 2.0.0 release is not backwards compatible, so when you install, it tries to use the most recent (but incompatible) version, causing the error you posted.
The fix in https://github.com/jmschrei/pomegranate/issues/1052 hasn't been pushed. If it ever does get pushed/released, there may still be problems if they release it under 0.14.10 since cnvkit asks for pomegranate >= 0.14.8, <=0.14.9.
The fastest fix is to download a version of pomegranate labelled as release 0.14.9 that asks for numpy <2.0.0. This repo I made does precisely that. I was able to install cnvkit by making sure I downloaded old versions of the problematic dependencies (cython, numpy) and then the "new" pomegranate.
Try doing
pip uninstall cython numpy -y
pip install cython==0.29.17 numpy==1.26.4 -y
git clone -b v0.14.9 --single-branch https://github.com/tiwalayo/pomegranate.git
pip install -e pomegranate/
Thank you tiwalayo It works like a charm. You saved me a lot of time. Thank you! :)
@tiwalayo Thx for patched version of pomegranate. Btw - pomegranate 1.15.0 finally released - so it can be used in cnvkit requirements.
FYI - you can install your version in one-liner: pip3 install git+https://github.com/tiwalayo/[email protected]
@etal We deeply need patch for cnvkit requirements - currently it asks pomegranate >= 0.14.8, <=0.14.9, you can switch to pomegranate >= 0.14.8, <=0.15.0 or maybe better pomegranate >= 0.14.8, <1.0.0 for future legacy problems.
Thanks for the guidance. I can update the CNVkit requirements to use pomegranate >= 0.14.8, <1.0.0 in the short term.
The longer-term fix of using pomegranate 1.x is a bit more involved. WIP here, help would be welcome: https://github.com/etal/cnvkit/pull/910
Fixed here: https://github.com/etal/cnvkit/pull/911
Does installation work for you now?
@etal Will you create new tag or update current 0.9.11?
@etal Hello again. What about new tag?
Dear @etal could you tag/create a new release with this fix, please?
Yep, sorry for the wait. I've released a new version with this fix: https://github.com/etal/cnvkit/releases/tag/v0.9.12
Hi, thank you for your work!
Is it possible to update the cnvkit version on PyPI? Because I found only the v0.9.11, which gives the above problem if I try to install it with pip.