【发布时间】:2021-12-26 18:20:34
【问题描述】:
我之前已经能够运行和安装pandas 库...
包括 IDLE 回溯,在帖子底部。
我开始相信我的设置存在更多潜在的严重问题。真的不知道是什么问题。
$ pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
终端:
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install --upgrade pip
Collecting pip
Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 722 kB/s
Installing collected packages: pip
Successfully installed pip-21.3.1
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install pandas
Requirement already satisfied: pandas in /home/me/.local/lib/python3.8/site-packages (1.3.4)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2.8.2)
Requirement already satisfied: numpy>=1.17.3; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in /home/me/.local/lib/python3.8/site-packages (from pandas) (1.21.3)
Requirement already satisfied: pytz>=2017.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2021.3)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry add pandas
Using version ^1.3.4 for pandas
Updating dependencies
Resolving dependencies... (649.1s)
SolverProblemError
The current project's Python requirement (>=3.8,<4.0) is not compatible with some of the required packages Python requirement:
- tensorflow-io-gcs-filesystem requires Python >=3.6, <3.10, so it will not be satisfied for Python >=3.10,<4.0
- tensorflow-io-gcs-filesystem requires Python >=3.6, <3.10, so it will not be satisfied for Python >=3.10,<4.0
Because no versions of tensorflow match >2.5.0,<2.5.1 || >2.5.1,<2.5.2 || >2.5.2,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0
and tensorflow (2.5.1) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.5.2 || >2.5.2,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.5.2) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.6.0) depends on numpy (>=1.19.2,<1.20.0)
and tensorflow (2.6.1) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.6.2) depends on numpy (>=1.19.2,<1.20.0)
and tensorflow (2.5.0) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>=2.5.0,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
Because no versions of pandas match >1.3.4,<2.0.0
and pandas (1.3.4) depends on numpy (>=1.20.0), pandas (>=1.3.4,<2.0.0) requires numpy (>=1.20.0).
Thus, pandas (>=1.3.4,<2.0.0) is incompatible with tensorflow (>=2.5.0,<2.7.0 || >2.7.0,<3.0.0).
(1) So, because tensorflow (2.7.0) depends on tensorflow-io-gcs-filesystem (>=0.21.0), if pandas (>=1.3.4,<2.0.0) and tensorflow (>=2.5.0,<3.0.0) then tensorflow-io-gcs-filesystem (>=0.21.0).
Because no versions of tensorflow-io-gcs-filesystem match >0.21.0,<0.22.0 || >0.22.0
and tensorflow-io-gcs-filesystem (0.21.0) requires Python >=3.6, <3.10, tensorflow-io-gcs-filesystem is forbidden.
And because tensorflow-io-gcs-filesystem (0.22.0) requires Python >=3.6, <3.10, tensorflow-io-gcs-filesystem is forbidden.
And because if pandas (>=1.3.4,<2.0.0) and tensorflow (>=2.5.0,<3.0.0) then tensorflow-io-gcs-filesystem (>=0.21.0) (1), pandas (>=1.3.4,<2.0.0) is incompatible with tensorflow (>=2.5.0,<3.0.0)
So, because data-simulator depends on both tensorflow (^2.5.0) and pandas (^1.3.4), version solving failed.
at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
• Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
For tensorflow-io-gcs-filesystem, a possible solution would be to set the `python` property to ">=3.8,<3.10"
For tensorflow-io-gcs-filesystem, a possible solution would be to set the `python` property to ">=3.8,<3.10"
https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
https://python-poetry.org/docs/dependency-specification/#using-environment-markers
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry run python3 cli.py
Traceback (most recent call last):
File "cli.py", line 5, in <module>
from alien import *
File "/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src/alien.py", line 3, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
建议的解决方案:
卸载,重新安装,再次运行失败。
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall pandas
Found existing installation: pandas 1.3.4
Uninstalling pandas-1.3.4:
Would remove:
/home/me/.local/lib/python3.8/site-packages/pandas-1.3.4.dist-info/*
/home/me/.local/lib/python3.8/site-packages/pandas/*
Proceed (y/n)? Y
Successfully uninstalled pandas-1.3.4
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install pandas
Collecting pandas
Using cached pandas-1.3.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
Requirement already satisfied: pytz>=2017.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2021.3)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2.8.2)
Requirement already satisfied: numpy>=1.17.3; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in /home/me/.local/lib/python3.8/site-packages (from pandas) (1.21.3)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)
Installing collected packages: pandas
poetry run python3 cli.py
Successfully installed pandas-1.3.4
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry run python3 cli.py
Traceback (most recent call last):
File "cli.py", line 5, in <module>
from alien import *
File "/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src/alien.py", line 3, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
空闲:
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> ls
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
ls
NameError: name 'ls' is not defined
>>> import pandas as pd
Warning (from warnings module):
File "C:\Users\me\Anaconda3\lib\site-packages\numpy\__init__.py", line 143
from . import _distributor_init
UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pandas as pd
File "C:\Users\me\Anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\Users\me\Anaconda3\pythonw.exe"
* The NumPy version is: "1.20.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
>>>
卸载 Numpy 成功,但安装工具失败
danielbellhv@PF2DCSXD:/mnt/c/Users/dabell/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall -y numpy
Found existing installation: numpy 1.21.3
Uninstalling numpy-1.21.3:
Successfully uninstalled numpy-1.21.3
danielbellhv@PF2DCSXD:/mnt/c/Users/dabell/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall -y setuptools
Found existing installation: setuptools 45.2.0
Uninstalling setuptools-45.2.0:
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/shutil.py", line 791, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/__pycache__/easy_install.cpython-38.pyc' -> '/tmp/pip-uninstall-cmpyrogm/easy_install.cpython-38.pyc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
status = run_func(*args)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 97, in run
uninstall_pathset = req.uninstall(
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 671, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 384, in remove
moved.stash(path)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 282, in stash
renames(path, new_path)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 307, in renames
shutil.move(old, new)
File "/usr/lib/python3.8/shutil.py", line 812, in move
os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/__pycache__/easy_install.cpython-38.pyc'
更改文件的权限失败:
me@PF2DCSXD:/usr/lib/python3/dist-packages/__pycache__$ chmod 755 easy_install.cpython-38.pyc
chmod: changing permissions of 'easy_install.cpython-38.pyc': Operation not permitted
请告诉我还有什么我可以尝试或添加到帖子中的内容
【问题讨论】:
-
您使用虚拟环境吗?如果没有,您可以尝试使用一个吗?
-
我正在使用包依赖处理程序诗歌。所以我希望它可以在任何环境中的任何机器上运行。还是我应该无论如何?只是以前不需要。
-
你的 pip 版本是多少?你检查过这个问题github.com/python-poetry/poetry/issues/3894 吗?
-
pip 20.0.2。我会检查那个帖子。 -
尝试升级您的点子再试一次
标签: python pandas python-poetry modulenotfounderror