egg_info for package mock produced metadata for project name unknown
See original GitHub issueWe’re having issues in our project when building its test containers when installing mock per our test-requirements.txt:
flake8; python_version >= '2.7'
mock; python_version >= '2.7'
unittest2
Results in:
Collecting mock (from -r test-requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/1c/fd/141c477591ab50e27cd16a4969c957f915f4fb3c6323a624c548f38b507f/mock-4.0.1.tar.gz (71kB)
100% |################################| 81kB 6.3MB/s
Running setup.py (path:/tmp/pip-build-nxyrPI/mock/setup.py) egg_info for package mock produced metadata for project name unknown. Fix your #egg=mock fragments.
<snip>
Successfully installed argparse configparser entrypoints enum34 flake8 functools32 linecache2 mccabe pycodestyle pyflakes traceback2 typing unittest2 unknown
Notice the ‘unknown’
And when running the tests:
python2 test/unittest_suite.py
Traceback (most recent call last):
File "test/unittest_suite.py", line 38, in <module>
map(__import__, modules)
File "/app/test/test_katello/test_enabled_report.py", line 4, in <module>
from mock import patch
ImportError: No module named mock
Our project: https://github.com/Katello/katello-host-tools/
Reproduced by make docker-test target which defaults to a CentOS7 container
Seems to have happened with the 4.0.0 release. Let me know if I can provide any more useful information!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Pip install issue with egg fragments that lead to an UNKNOWN ...
... egg_info for package only produced metadata for project name unknown. Fix your #egg=only fragments. Successfully downloaded unknown.
Read more >Package importlib-resources produced metadata for ... - GitLab
Hi @warsaw, With the newest version of importlib_resources I'm seeing the following error in my Appveyor...
Read more >History - setuptools 65.6.3.post20221220 documentation
egg-info directory is produced inside the project dir, which may not be the case in editable installs (the .egg-info directory is produced inside...
Read more >python-build - Simple, correct PEP517 package builder
Weird that it built in Koji, since it fails to build in mock for me. ... Hint: make sure your test modules/packages have...
Read more >mozilla-central: changeset 542358 ...
third_party/python/importlib_metadata/importlib_metadata.egg-info/PKG- ... It is constructed with - the name of the python package and the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Right, so Mock no longer supports Python 2, and those versions of pip and setuptools are really really ancient. You should be using setuptools 44 (45 dropped Py2 support) and pip 20. I suspect if you were using those, even on Python 2, they would have looked at the package metadata and kept your install on Mock 3.x.
That said, looks like you’re using docker images, in which case the system rpms for these aren’t the right thing to use, why not use the official python images on docker hub?
Honestly, it’s not fine to be on such ancient versions of pip and setuptools - they will cause you more problems like this, and some that might not be so apparent.