Skip to content
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

setup.py fails to run on Ubuntu 20.04 #1190

Closed
joachimmetz opened this issue May 12, 2020 · 9 comments
Closed

setup.py fails to run on Ubuntu 20.04 #1190

joachimmetz opened this issue May 12, 2020 · 9 comments
Assignees
Labels
Deployment Issue related to deployment

Comments

@joachimmetz
Copy link
Member

When trying to build a dpkg source package on Ubuntu 20.04

 dpkg-source --before-build .
 fakeroot debian/rules clean
dh clean --buildsystem=pybuild --with=python3,systemd
   dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:217: python3.8 setup.py clean 
Traceback (most recent call last):
  File "setup.py", line 32, in <module>
    from pip._internal.download import PipSession
ModuleNotFoundError: No module named 'pip._internal.download'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 35, in <module>
    from pip.download import PipSession
ModuleNotFoundError: No module named 'pip.download'
E: pybuild pybuild:341: clean: plugin distutils failed with: exit code=1: python3.8 setup.py clean 
dh_auto_clean: error: pybuild --clean -i python{version} -p 3.8 returned exit code 13
make: *** [debian/rules:4: clean] Error 25
dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2
debuild: fatal error at line 1182:
dpkg-buildpackage -us -uc -ui -S -sa failed

pip-python3 is installed

python3
>>> import pip.download
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pip.download'
>>> import pip
>>> pip.__version__
'20.0.2'
@joachimmetz joachimmetz added the Deployment Issue related to deployment label May 12, 2020
@garanews
Copy link
Contributor

image

then need to fix
Traceback (most recent call last): File "setup.py", line 84, in <module> 'requirements.txt', session=PipSession(), File "setup.py", line 83, in <listcomp> install_requires=[str(req.req) for req in parse_requirements( AttributeError: 'ParsedRequirement' object has no attribute 'req'

@joachimmetz
Copy link
Member Author

@garanews thx for the suggestion but IMHO if something is named pip._internal, to me hints like a strong discouragement of using it external to pip module

@garanews
Copy link
Contributor

Need to modify something because pip>20.0 breaks module: pypa/pip#7645

Modified this:
install_requires=[str(req.req) for req in parse_requirements(
'requirements.txt', session=PipSession(),
)],`

in this:

str(req.requirement)
for req in parse_requirements("requirements.txt", session=PipSession(),)
],

@garanews
Copy link
Contributor

Hello,
we solved in this way: https://github.com/LDO-CERT/mans_to_es/blob/master/setup.py
Would you like a pr here in the same way to fix issue?

@joachimmetz
Copy link
Member Author

@joachimmetz
Copy link
Member Author

joachimmetz commented May 26, 2020

pkg_resources.parse_requirements() seems to be the recommended alternative
https://setuptools.readthedocs.io/en/latest/pkg_resources.html#requirements-parsing

@joachimmetz joachimmetz self-assigned this May 26, 2020
@joachimmetz
Copy link
Member Author

@garanews I strongly recommend changing this in mans_to_es as well to use pkg_resources instead of PIP internal APIs

@joachimmetz
Copy link
Member Author

joachimmetz commented May 26, 2020

Unfortunately this fails with older versions of setuptools/pip (https://travis-ci.org/github/google/timesketch/jobs/691184377)

@joachimmetz
Copy link
Member Author

Addressed in #1225 and tests added in #1220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deployment Issue related to deployment
Projects
None yet
Development

No branches or pull requests

2 participants