Yappi ModuleNotFoundError даже после установки
Я успешно установил yappi, но все равно получаю ModuleNotFoundError при импорте yappi в той же оболочке:
((python) ) soumeng78@linux-16 $ pipenv install git+https://github.com/sumerc/yappi#egg=yappi
Installing git+https://github.com/sumerc/yappi#egg=yappi...
Adding yappi to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock (db4242) out of date, updating to (b482eb)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Updated Pipfile.lock (b482eb)!
Installing dependencies from Pipfile.lock (b482eb)...
ðŸ ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
((python) ) soumeng78@linux-16 $ python
Python 3.9.6 (default, Jan 4 2022, 00:31:29)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yappi
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<stdin> 1 <module>
1
ModuleNotFoundError:
No module named 'yappi'
Любая идея, как заставить его работать? Я хочу использовать yappi для профилирования функции.
1 ответ
Удаление старой среды и воссоздание среды решили проблему. Похоже, какая-то проблема с pipenv.
Когда я попытался установить тот же pip в виртуальной среде conda в Windows, у меня возникла следующая проблема - кажется, какая-то проблема с пакетом:
Collecting yappi
Using cached yappi-1.3.3.tar.gz (58 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: yappi
Building wheel for yappi (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
copying yappi\yappi.py -> build\lib.win-amd64-3.8
running build_ext
building '_yappi' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for yappi
Running setup.py clean for yappi
Failed to build yappi
Installing collected packages: yappi
Running setup.py install for yappi ... error
error: subprocess-exited-with-error
× Running setup.py install for yappi did not run successfully.
│ exit code: 1
╰─> [11 lines of output]
running install
C:\Users\gsoumen\Miniconda3\envs\kubeflow-pipeline\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
copying yappi\yappi.py -> build\lib.win-amd64-3.8
running build_ext
building '_yappi' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> yappi