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

module 'platform' has no attribute 'linux_distribution' #32

Open
theduckchannel opened this issue Sep 1, 2020 · 3 comments
Open

module 'platform' has no attribute 'linux_distribution' #32

theduckchannel opened this issue Sep 1, 2020 · 3 comments

Comments

@theduckchannel
Copy link

py2deb -v crazydiskmark Tue 01 Sep 2020 07:27:41 PM UTC
2020-09-01 16:27:48 shadowBox pip_accel[89399] INFO Unpacking distribution(s) ..
2020-09-01 16:27:48 shadowBox pip_accel[89399] INFO Executing command: pip install --download=/home/fredlins/.pip-accel/sources --find-links=file:///home/fredlins/.pip-accel/sources --no-binary=:all: --no-index --no-clean --build-directory=/tmp/pip-accel-build-dir-nl_2re2q --ignore-installed crazydiskmark
2020-09-01 16:27:48 shadowBox pip.commands.install[89399] INFO Ignoring indexes: https://pypi.python.org/simple
2020-09-01 16:27:48 shadowBox py2deb.cli[89399] ERROR Caught an unhandled exception!
Traceback (most recent call last):
File "/home/fredlins/.local/lib/python3.8/site-packages/py2deb/cli.py", line 200, in main
archives, relationships = converter.convert(arguments)
File "/home/fredlins/.local/lib/python3.8/site-packages/py2deb/converter.py", line 736, in convert
self.packages_to_convert = list(self.get_source_distributions(pip_install_arguments))
File "/home/fredlins/.local/lib/python3.8/site-packages/py2deb/converter.py", line 793, in get_source_distributions
for requirement in self.pip_accel.get_requirements(arguments):
File "/home/fredlins/.local/lib/python3.8/site-packages/pip_accel/init.py", line 297, in get_requirements
return self.unpack_source_dists(arguments, use_wheels=use_wheels)
File "/home/fredlins/.local/lib/python3.8/site-packages/pip_accel/init.py", line 393, in unpack_source_dists
requirements = self.get_pip_requirement_set(arguments, use_remote_index=False, use_wheels=use_wheels)
File "/home/fredlins/.local/lib/python3.8/site-packages/pip_accel/init.py", line 497, in get_pip_requirement_set
requirement_set = command.run(opts, args)
File "/home/fredlins/.local/lib/python3.8/site-packages/pip/commands/install.py", line 245, in run
with self._build_session(options) as session:
File "/home/fredlins/.local/lib/python3.8/site-packages/pip/basecommand.py", line 65, in _build_session
session = PipSession(
File "/home/fredlins/.local/lib/python3.8/site-packages/pip/download.py", line 316, in init
self.headers["User-Agent"] = user_agent()
File "/home/fredlins/.local/lib/python3.8/site-packages/pip/download.py", line 92, in user_agent
zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'

@chy-causer
Copy link

Can confirm that this is an issue for me in a virtual environment running Python 3.9. The reason is that py2deb has a requirement on pip-accel <=0.43, which in turn has a requirement on pip <7.2.

This version of pip is not compatible with modern Python versions (3.8+).

@ygbourhis
Copy link

I confirm the issue with Python 3.8.10 on Ubuntu 20.04.3 LTS.

@kakaday22
Copy link

I have a local patch to get it working in 3.8+

sed -i '/import platform/a import distro as os_version' "/usr/local/lib/python${VERSION}/site-packages/pip/download.py"
sed -i 's/platform.linux_distribution/os_version.linux_distribution/g' "/usr/local/lib/python${VERSION}/site-packages/pip/download.py"

where, VERSION=3.8

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

No branches or pull requests

4 participants