Installed module not found in Github Actions environment
bczsalba opened this issue · 4 comments
Description
Installation (pip install .
) in a GH Action environment fails due to ModuleNotFoundError
, even though the module was setup.py
's install_requires
. The module (typing_extensions
in this case) is installed; stdout clearly shows that installation did finish for it, and pip freeze
shows the module with the correct version.
The same behaviour exists even when pip install <affected_module>
is run as the command immediately before pip install .
Expected behavior
The installation should complete with no errors.
pip version
22.1.2
Python version
Tested on 3.8, 3.9, 3.10.
OS
Tested on Windows, Linux and MacOS (hosted) GitHub Action runners
How to Reproduce
Not sure if this occurs on other projects, but this is essentially what makes PyTermGUI fail:
- Include
typing_extensions
(or possibly other modules) in setup.py - Ensure (by using
pip freeze
orpip list -v
) that the module was installed - Write some module code that makes use of the dependency
- See
ModuleNotFoundError
Output
$ python -m pip install --upgrade pip
Requirement already satisfied: pip in /opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages (22.1.2)
$ pip install testfixtures
Collecting testfixtures
Downloading testfixtures-7.0.0-py3-none-any.whl (97 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.3/97.3 kB 8.1 MB/s eta 0:00:00
Installing collected packages: testfixtures
Successfully installed testfixtures-7.0.0
$ pip install pytest-cov
Collecting pytest-cov
Downloading pytest_cov-3.0.0-py3-none-any.whl (20 kB)
Collecting coverage[toml]>=5.2.1
Downloading coverage-6.4.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (212 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 212.3/212.3 kB 14.3 MB/s eta 0:00:00
Collecting pytest>=4.6
Downloading pytest-7.1.2-py3-none-any.whl (297 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 297.0/297.0 kB 41.2 MB/s eta 0:00:00
Collecting tomli
Downloading tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting iniconfig
Downloading iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
Collecting pluggy<2.0,>=0.12
Downloading pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
Collecting packaging
Downloading packaging-21.3-py3-none-any.whl (40 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.8/40.8 kB 13.3 MB/s eta 0:00:00
Collecting py>=1.8.2
Downloading py-1.11.0-py2.py3-none-any.whl (98 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.7/98.7 kB 23.8 MB/s eta 0:00:00
Collecting attrs>=19.2.0
Downloading attrs-21.4.0-py2.py3-none-any.whl (60 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.6/60.6 kB 18.7 MB/s eta 0:00:00
Collecting pyparsing!=3.0.5,>=2.0.2
Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.3/98.3 kB 26.9 MB/s eta 0:00:00
Installing collected packages: iniconfig, tomli, pyparsing, py, pluggy, coverage, attrs, packaging, pytest, pytest-cov
Successfully installed attrs-21.4.0 coverage-6.4.2 iniconfig-1.1.1 packaging-21.3 pluggy-1.0.0 py-1.11.0 pyparsing-3.0.9 pytest-7.1.2 pytest-cov-3.0.0 tomli-2.0.1
$ pip install coverage
Requirement already satisfied: coverage in /opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages (6.4.2)
$ pip install pyyaml
Collecting pyyaml
Downloading PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (682 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 682.2/682.2 kB 26.1 MB/s eta 0:00:00
Installing collected packages: pyyaml
Successfully installed pyyaml-6.0
$ pip install typing-extensions
Collecting typing-extensions
Downloading typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Installing collected packages: typing-extensions
Successfully installed typing-extensions-4.3.0
$ pip freeze
attrs==21.4.0
coverage==6.4.2
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.0.9
pytest==7.1.2
pytest-cov==3.0.0
PyYAML==6.0
testfixtures==7.0.0
tomli==2.0.1
typing_extensions==4.3.0
$ pip install .
Processing /home/runner/work/pytermgui/pytermgui
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 'error'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [25 lines of output]
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-phxpdd6x/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
return self._get_build_requires(
File "/tmp/pip-build-env-phxpdd6x/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-phxpdd6x/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 281, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-phxpdd6x/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
exec(code, locals())
File "<string>", line 3, in <module>
File "/home/runner/work/pytermgui/pytermgui/pytermgui/__init__.py", line 25, in <module>
from .exporters import *
File "/home/runner/work/pytermgui/pytermgui/pytermgui/exporters.py", line 14, in <module>
from .markup import StyledText, Token, tim
File "/home/runner/work/pytermgui/pytermgui/pytermgui/markup/__init__.py", line 3, in <module>
from . import tokens
File "/home/runner/work/pytermgui/pytermgui/pytermgui/markup/tokens.py", line 13, in <module>
from typing_extensions import TypeGuard
ModuleNotFoundError: No module named 'typing_extensions'
[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.
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Since pytermgui
has a pyproject.toml
, this triggers build isolation. Since pytermgui
's build process seem to require typing_extensions
but does not declare it in its pyproject.toml, that library is not installed in the isolated build environment and the build fails.
Since you pre-installed typing_extension, you can try running pip install
with --no-build-isolation
.
I also suggest raising the issue with the pytermgui project.
I also suggest raising the issue with the pytermgui project.
I would, but sadly it wouldn't change who has to deal with it since I'm the creator :D
Would switching over to a full pyproject.toml
based build system fix this issue? I've been meaning to do it for a while but never had the push to do it.
Would switching over to a full pyproject.toml based build system fix this issue?
Yes, it would.
Thank you then! I think you did everything to help (extremely fast too, might I say), so I'll close the issue.
Have a great day!