How to Support python3.8

NX default is python3.6, but to low, so i install with “atp install python3.8”. but not to work as flow:
Successfully installed setuptools-53.0.0
e]0;root@b1f3bd116116: /opt/srcroot@b1f3bd116116:/opt/src# pip3 install --upgrade setuptoolsr myrequirements.txt
Collecting matplotlib>=3.2.2 (from -r myrequirements.txt (line 6))
Using cached https://files.pythonhosted.org/packages/22/d4/e7ca532e68a9357742604e1e4ae35d9c09a4a810de39a9d80402bd12f50f/matplotlib-3.3.4.tar.gz
Complete output from command python setup.py egg_info:
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/setuptools/installer.py”, line 75, in fetch_build_egg
subprocess.check_call(cmd)
File “/usr/lib/python3.8/subprocess.py”, line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[’/usr/bin/python3.8’, ‘-m’, ‘pip’, ‘–disable-pip-version-check’, ‘wheel’, ‘–no-deps’, ‘-w’, ‘/tmp/tmpfwuwxqfm’, ‘–quiet’, ‘numpy>=1.15’]’ returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-atrkgz3i/matplotlib/setup.py", line 256, in <module>
    setup(  # Finally, pass this all along to distutils to do the heavy lifting.
  File "/usr/local/lib/python3.8/dist-packages/setuptools/__init__.py", line 152, in setup
    _install_setup_requires(attrs)
  File "/usr/local/lib/python3.8/dist-packages/setuptools/__init__.py", line 147, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/usr/local/lib/python3.8/dist-packages/setuptools/dist.py", line 686, in fetch_build_eggs
    resolved_dists = pkg_resources.working_set.resolve(
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 766, in resolve
    dist = best[req.key] = env.best_match(
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 1051, in best_match
    return self.obtain(req, installer)
  File "/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py", line 1063, in obtain
    return installer(requirement)
  File "/usr/local/lib/python3.8/dist-packages/setuptools/dist.py", line 745, in fetch_build_egg
    return fetch_build_egg(self, req)
  File "/usr/local/lib/python3.8/dist-packages/setuptools/installer.py", line 77, in fetch_build_egg
    raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/bin/python3.8', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpfwuwxqfm', '--quiet', 'numpy>=1.15']' returned non-zero exit status 1.

Edit setup.cfg to change the build options; suppress output with --quiet.

BUILDING MATPLOTLIB
  matplotlib: yes [3.3.4]
      python: yes [3.8.0 (default, Oct 28 2019, 16:14:01)  [GCC 8.3.0]]
    platform: yes [linux]
 sample_data: yes [installing]
       tests: no  [skipping due to configuration]
      macosx: no  [Mac OS-X only]


----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-atrkgz3i/matplotlib/
e]0;root@b1f3bd116116: /opt/srcroot@b1f3bd116116:/opt/src# pip3 install -r myrequirements.txt matplotlib>=3.2.2
Could not open requirements file: [Errno 2] No such file or directory: ‘matplotlib’
e]0;root@b1f3bd116116: /opt/srcroot@b1f3bd116116:/opt/src# pip3 install -r matplotlib>=3.2.2
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-it64iglw/matplotlib/
e]0;root@b1f3bd116116: /opt/srcroot@b1f3bd116116:/opt/src# pip3 install matplotlib>=3.2.2 un
Cannot uninstall requirement matplotlib, not installed
e]0;root@b1f3bd116116: /opt/srcroot@b1f3bd116116:/opt/src# pip3 install neuralpy
Collecting neuralpy
Downloading https://files.pythonhosted.org/packages/aa/6f/5d4f1c90fd944108d63428a33fae99d931da110cf13a8c64991474d87f90/neuralpy-1.3.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-build-3wd4hruu/neuralpy/setup.py”, line 2
print find_packages(exclude=[‘DEPneuralpy’])
^
SyntaxError: invalid syntax

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-3wd4hruu/neuralpy/
e]0;root@b1f3bd116116: /opt/srcroot@b1f3bd116116:/opt/src# pip install --upgrade setuptools --user python3.83
Requirement already up-to-date: setuptools in /usr/local/lib/python3.8/dist-packages
Collecting python3.8
Exception:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/usr/lib/python3/dist-packages/pip/commands/install.py”, line 353, in run
wb.build(autobuilding=True)
File “/usr/lib/python3/dist-packages/pip/wheel.py”, line 749, in build
self.requirement_set.prepare_files(self.finder)
File “/usr/lib/python3/dist-packages/pip/req/req_set.py”, line 376, in prepare_files
discovered_reqs.extend(self._prepare_file(
File “/usr/lib/python3/dist-packages/pip/req/req_set.py”, line 551, in _prepare_file
req_to_install.populate_link(
File “/usr/lib/python3/dist-packages/pip/req/req_install.py”, line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File “/usr/lib/python3/dist-packages/pip/index.py”, line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File “/usr/lib/python3/dist-packages/pip/index.py”, line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File “/usr/lib/python3/dist-packages/pip/index.py”, line 568, in _get_pages
page = self._get_page(location)
File “/usr/lib/python3/dist-packages/pip/index.py”, line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File “/usr/lib/python3/dist-packages/pip/index.py”, line 795, in get_page
resp.raise_for_status()
File “/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py”, line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/python3-8/
e]0;root@b1f3bd116116: /opt/srcroot@b1f3bd116116:/opt/src# pip3 install --upgrade setuptools --user python3.8
Requirement already up-to-date: setuptools in /usr/local/lib/python3.8/dist-packages
Collecting python3
Exception:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/usr/lib/python3/dist-packages/pip/commands/install.py”, line 353, in run
wb.build(autobuilding=True)
File “/usr/lib/python3/dist-packages/pip/wheel.py”, line 749, in build
self.requirement_set.prepare_files(self.finder)
File “/usr/lib/python3/dist-packages/pip/req/req_set.py”, line 376, in prepare_files
discovered_reqs.extend(self._prepare_file(
File “/usr/lib/python3/dist-packages/pip/req/req_set.py”, line 551, in _prepare_file
req_to_install.populate_link(
File “/usr/lib/python3/dist-packages/pip/req/req_install.py”, line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File “/usr/lib/python3/dist-packages/pip/index.py”, line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File “/usr/lib/python3/dist-packages/pip/index.py”, line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File “/usr/lib/python3/dist-packages/pip/index.py”, line 568, in _get_pages
page = self._get_page(location)
File “/usr/lib/python3/dist-packages/pip/index.py”, line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File “/usr/lib/python3/dist-packages/pip/index.py”, line 795, in get_page
resp.raise_for_status()
File “/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py”, line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/python3/

Hi,

Could you try to build it from source to see if it works?
For example, here is a sharing from one of our user:

Thanks.

I fix it as flow:
step 1、
apt-get install python3.8
apt-get install python3.8-dev

step 2、
wget https://files.pythonhosted.org/packages/b7/2d/ad02de84a4c9fd3b1958dc9fb72764de1aa2605a9d7e943837be6ad82337/pip-21.0.1.tar.gz
tar -xzvf pip-21.0.1.tar.gz
cd pip-21.0.1
python3.8 setup.py install

pip3 -V

if pip -V show as:
pip 21.0.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)

step3:please modify /usr/bin/pip3 file as:
#!/usr/bin/python3.8

then used “pip3 -V”
pip3 -V
pip 21.0.1 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)

1 Like

Good to know this.
And thanks for reporting the steps back : )

Hi,

I tried this fix for updating to Python 3.8, but I get this error:

apt-get install python3.8
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

I am running Jetpack 4.5 from a SSD drive. I used the JetsonHacks method to achieve this. Does anyone have a solution for my problem?

Thank you in advance for any assistance offered.

Best wishes,

Paul

Hi @paul.britten
You should run with “sudo”

sudo apt-get install python3.8

instead of

apt-get install python3.8

1 Like

Thanks again for your help. It is greatly appreciated.

using sudo at the start of the command worked but i then ran into this issue:

python3.8 setup.py install
Traceback (most recent call last):
File “setup.py”, line 7, in
from setuptools import find_packages, setup
ModuleNotFoundError: No module named ‘setuptools’

Do you know the cause of this at all?

Best wishes,

Paul

Hi @paul.britten, please type:

pip3 install setuptools

1 Like

Hi @mehmetdeniz ,

Tried:

pip3 install setuptools

I get this:

bash: pip3: command not found

It would appear I don’t have pip3 on my system. I went looking for it in the Python folders and it is not there. Any ideas?

Thanks again for taking the time to help me out.

Best wishes,

Paul

Hi @paul.britten ,
you can install it with this command:

sudo apt install python3-pip

1 Like

Hi @mehmetdeniz ,

Finally got everything installed as above and changed the binary file to point to Python 3.8 for pip3 to work for 3.8.

Now when I try to install a Python library using pip3 I get this:

Defaulting to user installation because normal site-packages is not writeable

Do you happen to know what I have done wrong here?

All the best,

Paul

Maybe this can help you

python3 -m pip install [package_name]
1 Like

Thanks @mehmetdeniz , I eventually got everything working but I also had to install Cython to get libraries like numpy etc. to install.

This saved me a load of time. As i managed to mess up my Jetpack install once and had to start all over again trying all different types of solutions.

Best wishes,

Paul

Just to update on this. It appears that it didn’t install the libraries I wanted into Python 3.8 but instead installed them into my Python 3.6. Unfortunately, I need >3.6 because I require scipy and it won’t install on 3.6.

Does anyone have a good fix for sorting this and making Python 3.8 my default selection for importing libraries?

All the best,

Paul

I tried it before with these commands:

python3 -V
sudo update-alternatives --config python3
python3 -V

Afterall, I needed to delete python 3.6 (to avoid package damages) and I damaged OS (power mode menu and sidebar launcher did not work etc.).
So that, if you gonna delete python 3.6, you can back your system up or you can isolate your system (with virtualenv or docker).

Thanks again for taking the time to help me here. I tried this and my system says I don’t have any other versions installed, which isn’t true as I can use it in VS Code. I just can’t load libraries into version 3.8.

In a previous attempt I did the same trying to uninstall 3.6 and it was a bad idea as I too damaged my OS. I have been trying to avoid virtualenv as I had a bad experience with it on my Mac took me a couple of days to unravel umpteen versions of python I ended up with. It would be a god send if OS developers could update their OS to not have a reliance on Python 3.6, so it can be deleted!

Looks like I may need to have a hard look at virtualenv and understand fully how it works and make sure I don’t get into the mess I did previously.

All the best,

Paul