-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip installs numpy but poetry does not #3894
Comments
Same issue here. Also link to #3627 |
So I may have information that could narrow down the specific [tool.poetry]
name = "demo"
version = "0.1.0"
description = ""
authors = ["Nick Anderegg <[email protected]>"]
[tool.poetry.dependencies]
python = ">=3.8,<3.10"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" In each directory, I ran a separate command to install something that has ~/tmp/poetry_numpy_tests/pip_install @ 10:18:31 PM
❯ poetry run pip3 install scipy
Creating virtualenv demo-J2g__jnb-py3.9 in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs
Collecting scipy
Using cached scipy-1.7.1-cp39-cp39-macosx_10_9_x86_64.whl (32.8 MB)
Collecting numpy<1.23.0,>=1.16.5
Using cached numpy-1.21.2-cp39-cp39-macosx_10_9_x86_64.whl (17.0 MB)
Installing collected packages: numpy, scipy
Successfully installed numpy-1.21.2 scipy-1.7.1
WARNING: You are using pip version 21.0.1; however, version 21.2.4 is available.
You should consider upgrading via the '/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-J2g__jnb-py3.9/bin/python -m pip install --upgrade pip' command.
10:18:44 PM ❯ ~/tmp/poetry_numpy_tests/python_pip @ 10:19:36 PM
❯ poetry run python -m pip install scipy
Creating virtualenv demo-4WzZmSBb-py3.9 in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs
Collecting scipy
Using cached scipy-1.7.1-cp39-cp39-macosx_10_9_x86_64.whl (32.8 MB)
Collecting numpy<1.23.0,>=1.16.5
Using cached numpy-1.21.2-cp39-cp39-macosx_10_9_x86_64.whl (17.0 MB)
Installing collected packages: numpy, scipy
Successfully installed numpy-1.21.2 scipy-1.7.1
WARNING: You are using pip version 21.0.1; however, version 21.2.4 is available.
You should consider upgrading via the '/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-4WzZmSBb-py3.9/bin/python -m pip install --upgrade pip' command.
10:19:49 PM ❯ Notice in each of the above cases, it took less than 15 seconds to fully install ~/tmp/poetry_numpy_tests/poetry_add @ 10:12:40 PM
❯ poetry add scipy
Creating virtualenv demo-SJ17AL5n-py3.9 in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs
Using version ^1.7.1 for scipy
Updating dependencies
Resolving dependencies... (0.1s)
Writing lock file
Package operations: 2 installs, 0 updates, 0 removals
• Installing numpy (1.21.2)
• Installing scipy (1.7.1): Failed
EnvCommandError
Command ['/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/bin/pip', 'install', '--no-deps', 'file:///Users/nickanderegg/Library/Caches/pypoetry/artifacts/47/9d/89/31f1fcd79c1d043c8ea0ac88c687e9828dc6d07d2a83f42219d8494328/scipy-1.7.1.tar.gz'] errored with the following return code 1, and output:
Processing /Users/nickanderegg/Library/Caches/pypoetry/artifacts/47/9d/89/31f1fcd79c1d043c8ea0ac88c687e9828dc6d07d2a83f42219d8494328/scipy-1.7.1.tar.gz
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: still running...
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/bin/python /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/tmpzqx_91eg
cwd: /private/var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/pip-req-build-rpp_yhya
Complete output (183 lines):
setup.py:490: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /private/var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/pip-modern-metadata-tg83lqya'), proceeding with generating Cython sources and expanding templates
warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
Running from SciPy source directory.
Running scipy/linalg/_generate_pyx.py
Running scipy/special/_generate_pyx.py
Running scipy/stats/_generate_pyx.py
Processing scipy/cluster/_vq.pyx
Processing scipy/cluster/_optimal_leaf_ordering.pyx
Processing scipy/cluster/_hierarchy.pyx
Processing scipy/ndimage/src/_cytest.pyx
Processing scipy/ndimage/src/_ni_label.pyx
Processing scipy/linalg/cython_lapack.pyx
Processing scipy/linalg/_matfuncs_sqrtm_triu.pyx
Processing scipy/linalg/_solve_toeplitz.pyx
Processing scipy/linalg/cython_blas.pyx
Processing scipy/linalg/_decomp_update.pyx.in
Processing scipy/optimize/_group_columns.pyx
Processing scipy/optimize/_bglu_dense.pyx
Processing scipy/optimize/_trlib/_trlib.pyx
Processing scipy/optimize/_highs/cython/src/_highs_constants.pyx
Processing scipy/optimize/_highs/cython/src/_highs_wrapper.pyx
Processing scipy/optimize/_lsq/givens_elimination.pyx
Processing scipy/optimize/cython_optimize/_zeros.pyx.in
Processing scipy/io/matlab/mio_utils.pyx
Processing scipy/io/matlab/streams.pyx
Processing scipy/io/matlab/mio5_utils.pyx
Processing scipy/_lib/_ccallback_c.pyx
Processing scipy/_lib/_test_deprecation_def.pyx
Processing scipy/_lib/_test_deprecation_call.pyx
Processing scipy/_lib/messagestream.pyx
Processing scipy/special/_ufuncs_cxx.pyx
Processing scipy/special/cython_special.pyx
Processing scipy/special/_ellip_harm_2.pyx
Processing scipy/special/_comb.pyx
Processing scipy/special/_test_round.pyx
Processing scipy/special/_ufuncs.pyx
Processing scipy/fftpack/convolve.pyx
Processing scipy/interpolate/interpnd.pyx
Processing scipy/interpolate/_bspl.pyx
warning: _cython_special_custom.pxi:9:8: Unreachable code
warning: _cython_special_custom.pxi:13:4: Unreachable code
warning: _cython_special_custom.pxi:21:8: Unreachable code
warning: _cython_special_custom.pxi:25:4: Unreachable code
warning: _cython_special_custom.pxi:33:8: Unreachable code
warning: _cython_special_custom.pxi:37:4: Unreachable code
warning: _cython_special_custom.pxi:45:8: Unreachable code
warning: _cython_special_custom.pxi:49:4: Unreachable code
Processing scipy/interpolate/_ppoly.pyx
Processing scipy/sparse/_csparsetools.pyx.in
Processing scipy/sparse/csgraph/_shortest_path.pyx
Processing scipy/sparse/csgraph/_traversal.pyx
Processing scipy/sparse/csgraph/_flow.pyx
Processing scipy/sparse/csgraph/_tools.pyx
Processing scipy/sparse/csgraph/_matching.pyx
Processing scipy/sparse/csgraph/_reordering.pyx
Processing scipy/sparse/csgraph/_min_spanning_tree.pyx
Processing scipy/spatial/ckdtree.pyx
Processing scipy/spatial/_voronoi.pyx
Processing scipy/spatial/_hausdorff.pyx
Processing scipy/spatial/qhull.pyx
Processing scipy/spatial/transform/rotation.pyx
Processing scipy/signal/_max_len_seq_inner.pyx
Processing scipy/signal/_peak_finding_utils.pyx
Processing scipy/signal/_upfirdn_apply.pyx
Processing scipy/signal/_spectral.pyx
Processing scipy/signal/_sosfilt.pyx
Processing scipy/stats/_stats.pyx
Processing scipy/stats/_qmc_cy.pyx
Processing scipy/stats/_sobol.pyx
Processing scipy/stats/biasedurn.pyx
Processing scipy/stats/_boost/src/beta_ufunc.pyx
Processing scipy/stats/_boost/src/nbinom_ufunc.pyx
Processing scipy/stats/_boost/src/binom_ufunc.pyx
Cythonizing sources
lapack_opt_info:
lapack_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_lapack_info:
libraries openblas not found in ['/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_clapack_info:
libraries openblas,lapack not found in ['/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
flame_info:
libraries flame not found in ['/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib
libraries tatlas,tatlas not found in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib
libraries lapack_atlas not found in /usr/local/lib
libraries tatlas,tatlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries tatlas,tatlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
libraries lapack_atlas not found in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib
libraries satlas,satlas not found in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib
libraries lapack_atlas not found in /usr/local/lib
libraries satlas,satlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries satlas,satlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib
libraries ptf77blas,ptcblas,atlas not found in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib
libraries lapack_atlas not found in /usr/local/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
libraries lapack_atlas not found in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib
libraries f77blas,cblas,atlas not found in /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib
libraries lapack_atlas not found in /usr/local/lib
libraries f77blas,cblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries f77blas,cblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
accelerate_info:
NOT AVAILABLE
lapack_info:
libraries lapack not found in ['/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
/private/var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/pip-build-env-2krl1upf/overlay/lib/python3.9/site-packages/numpy/distutils/system_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
lapack_src_info:
NOT AVAILABLE
/private/var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/pip-build-env-2krl1upf/overlay/lib/python3.9/site-packages/numpy/distutils/system_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
NOT AVAILABLE
Traceback (most recent call last):
File "/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/private/var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/pip-build-env-2krl1upf/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 166, in prepare_metadata_for_build_wheel
self.run_setup()
File "/private/var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/pip-build-env-2krl1upf/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 258, in run_setup
super(_BuildMetaLegacyBackend,
File "/private/var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/pip-build-env-2krl1upf/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 629, in <module>
setup_package()
File "setup.py", line 625, in setup_package
setup(**metadata)
File "/private/var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/pip-build-env-2krl1upf/overlay/lib/python3.9/site-packages/numpy/distutils/core.py", line 135, in setup
config = configuration()
File "setup.py", line 528, in configuration
raise NotFoundError(msg)
numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK libraries found. Note: Accelerate is no longer supported.
To build Scipy from sources, BLAS & LAPACK libraries need to be installed.
See site.cfg.example in the Scipy source directory and
https://docs.scipy.org/doc/scipy/reference/building/index.html for details.
----------------------------------------
WARNING: Discarding file:///Users/nickanderegg/Library/Caches/pypoetry/artifacts/47/9d/89/31f1fcd79c1d043c8ea0ac88c687e9828dc6d07d2a83f42219d8494328/scipy-1.7.1.tar.gz. Command errored out with exit status 1: /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/bin/python /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/tmpzqx_91eg Check the logs for full command output.
ERROR: Command errored out with exit status 1: /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/bin/python /Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/81/gn260m8d5011n2y3m_wcjc7w0000gn/T/tmpzqx_91eg Check the logs for full command output.
WARNING: You are using pip version 21.0.1; however, version 21.2.4 is available.
You should consider upgrading via the '/Users/nickanderegg/Library/Caches/pypoetry/virtualenvs/demo-SJ17AL5n-py3.9/bin/python -m pip install --upgrade pip' command.
at ~/.poetry/lib/poetry/utils/env.py:1074 in _run
1070│ output = subprocess.check_output(
1071│ cmd, stderr=subprocess.STDOUT, **kwargs
1072│ )
1073│ except CalledProcessError as e:
→ 1074│ raise EnvCommandError(e, input=input_)
1075│
1076│ return decode(output)
1077│
1078│ def execute(self, bin, *args, **kwargs):
Failed to add packages, reverting the pyproject.toml file to its original content.
10:17:21 PM ❯ |
Is there any update to this? I'm currently able to install numpy using pip (v21.3) but not poetry. I think this might be a pip version issue, as poetry is using 21.2.4, and stackoverflow seems to have some answers indicating that general |
With poetry 1.1.12 it works (it uses pip 21.3.1) |
I'm on 1.1.12 and I run into this too. |
I changed the python version in my pyproject.toml and it worked for me (MacOS Big Sur + Poetry version 1.1.12 + python 3.9.9):
|
I ran into the same issue on OSX. For me the solution was that I needed to build the BLAS and LAPACK libraries using Brew and then link them back to the Poetry build environment as explained in this Stackoverflow question: https://stackoverflow.com/a/70880741/1216837 |
I ran into the same issue on Windows 10 with poetry run pip install numpy scikit-learn
poetry add numpy scikit-learn |
this worked for me on MacOs M1 as well |
This is a common issue with NumPy and not a Poetry issue per-se. What is happening is that you have specified a wider Python range than the NumPy version that currently supports your Python version supports with built wheels. As such, you are attempting to compile from source and either need to provide NumPy's build dependencies, or pick a version based on wheel availability (and NumPy's support matrix at https://numpy.org/neps/nep-0029-deprecation_policy.html). In essence, you should If you're having problems, I'd suggest creating a Discussion or joining Discord -- this is going to be a configuration/usage problem and not a bug, so those are more appropriate venues. It would be nice to work on building a FAQ entry for NumPy as well as it's not the only package with strict version requirements. |
This didn't work for me unfortunately.
The last line is actually false. myproject depends on numpy, but not on that specific version, which I never specified anywhere ( But even if poetry insists on using Maybe I am missing something here. All I want is for my package to support older Python versions. What should I do when at the same time I need numpy? EDIT: I got it working with environment markers. AFAIK this can't be done directly with the CLI, but requires putting something like python = "^3.6"
numpy = [
{version = "*", python = "^3.8"},
{version = "~1.21.6", python = "=3.7"},
{version = "~1.19.5", python = "=3.6"}
] into pyproject.toml. The version numbers above are what I obtained from doing |
I just came here looking to suggest markers to you. Poetry does not resolve for the current environment, it resolves for all constraints in the configuration. |
@clintonroy But does it? In fact, I had to resolve for all those constraints myself with those markers, which was straight forward just using pip in the venvs, and therefore should be very doable for an automated tool. And that's exactly what I was expecting poetry would do for me. Instead it just tells me my constraints were unresolvable, which is just not true. |
This also solved the issue for me. Thanks @acviana |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate - I think it's here (Could not build wheels for XXX which use PEP 517 #1516, or here 1.0.10 -> 1.1 regression: EnvCommandError: 'No module named setuptools' on Python 3.7 #3153 - but i've done the work arounds (["setuptools", "poetry_core>=1.0"]) and nothing)
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: Latest Big Sur - 11.2.3
Poetry version: Poetry version 1.1.4
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/aronchick/65c366b27ccc7f14caa382f19841e6ab
Issue
Hi -- I've seen a bunch of other issues related to numpy, and know it's a numpy problem on Big Sur EXCEPT i think i've done everything right (in re upgrading), and I still get the following - works when I install numpy directly via pip, but fails from poetry. What should I do here?
The text was updated successfully, but these errors were encountered: