20

I'm working with tensorflow. Recently Arch replaced Python 3.8 with 3.9 and at the moment there is no tensorflow build for Python 3.9. Downgrading Python version for the whole system for that single reason do not looks like good idea for me. My goal is to create virtual environment with python 3.8. Is there a way to have both (3.8 and 3.9) versions available in the system? Python page of arch wiki doesn't mention that.

EDIT:

I know, I can use: virtualenv -p python3.8 py38 but I need an interpreter in the system.

izkeros
  • 790
  • 1
  • 5
  • 23
  • There are many ways to do this. My favorite way is to use Visual Studio Code with Extension: Remote - Containers. This allows to work in docker container. There you can use a different Linux distribution with different Python. The integration is very good. https://code.visualstudio.com/docs/remote/containers This way I'm working on multiple Node.js projects with different Node.js versions without having Node.js installed on my host system. – Thomas Sablik Dec 10 '20 at 08:21
  • 3
    https://github.com/pyenv/pyenv is nice enough. – AKX Dec 10 '20 at 08:25
  • 1
    _"What is the right way to ..."_ is an opinion based question. Usually and in this case there isn't the right way. There are multiple ways with different advantages and disadvantages. – Thomas Sablik Dec 10 '20 at 08:30
  • have a look at [(mini)conda](https://www.google.com/search?channel=trow2&client=firefox-b-d&q=miniconda) – cvanelteren Dec 10 '20 at 08:36
  • Regardless, this is a duplicate of ["Proper way" to manage multiple versions of Python on archlinux - Stack Overflow](https://stackoverflow.com/questions/7297094/proper-way-to-manage-multiple-versions-of-python-on-archlinux) . – user202729 Jan 04 '21 at 02:39
  • @ThomasSablik (the OP edited that part out.) – user202729 Jan 04 '21 at 02:39
  • What does "I need an interpreter in the system" mean? – ChrisGPT was on strike Sep 30 '21 at 17:52

2 Answers2

17

Go for package python38 in AUR, if you have an AUR helper like yay just use yay -S python38. Otherwise, just download the PKGBUILD and install manually with makepkg.

You can also update python with pacman -Syu (which is now python3.9). Then the two shall live together, inside /usr/bin/python3.x.

Use virtual environment to manage them if you like, virtualenv --python=/usr/bin/python3.x yourenvname.

Ahacad
  • 311
  • 2
  • 4
  • I may be in the same situation as OP. I build venv's , did a system upgrade on Dec 13th now none of my venv's are working properly. I have the following pyvenv.cfg `home = /usr/bin` `include-system-site-packages = false` `version = 3.8.2` will I need to update this after installing `python38` via AUR? – willwillis Jan 05 '21 at 22:45
  • 1
    @willwillis You will need to install a global Python 3.8. Your venvs should use it correctly once you do, possibly with some small tweaks. Fortunately, venvs are really easy to rebuild if you need to nuke them entirely. If you still need help, feel free to post a new question. – Code-Apprentice Sep 30 '21 at 20:01
1

Downgrading Python version for the whole system for that single reason do not looks like good idea for me.

This is a good observation. You should not modify the system installation of python. After you install the AUR package that Ahacad mentions. I suggest using virtualenv or the standard venv package to create a virtual environment for your tensorflow projects.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268