0

I have now installed Python 3.9, and have now replaced Python 3.8.

Running Terminal shows that Python 3.9 is being used:

Terminal using py39 venv

  • Why is it unacceptable to have multiple versions of python? There are some things that work with 3.8 that are still broken in 3.9. If you want to specifically use 3.9 for one of your own projects, it's best practice as it is to create a venv and operate inside there. – user3832673 Apr 03 '21 at 13:33
  • 1
    @astrochun Please don't post answers in the comments. Anyway, what you're recommending **will break things on Ubuntu**. ([example](https://askubuntu.com/q/880188/301745)) Don't do that! – wjandrea Apr 03 '21 at 13:40
  • Yes, mine says (base). I haven't made any alterations yet. I have a backup of this VM anyway, just in case. –  Apr 03 '21 at 13:43
  • Sorry, I thought this was a default python. Just realized it was conda. – astrochun Apr 03 '21 at 13:45
  • @astrochun Ah yeah, it is conda! I hadn't noticed either. I also just noticed that the [`python` package on Ubuntu 18.04](https://packages.ubuntu.com/bionic/python) is 2.7 and the [`python3` package](https://packages.ubuntu.com/bionic/python3) is 3.6. – wjandrea Apr 03 '21 at 13:46
  • 1
    I deleted my "answer" to avoid confusion. I do recommend using a `conda` environment in this case since `conda` is installed. I'll provide an answer below for how. – astrochun Apr 03 '21 at 13:47

2 Answers2

0

I would be careful about removing Python3.8 in case it's being used by systems where your Python 3.9 install won't work. I'd be particularly careful in this specific case since python3.9 doesn't seem to be in the ubuntu 18.4 apt repo, so I'm assuming you installed it from elsewhere.

In this case, did your python install go into a different directory? Perhaps you could set it up such that this other one be used by putting the other directory before /usr/bin in your $PATH.

If you're determined to uninstall python 3.8, I'd start by temporarily making it unavailable (such as using chmod 0, or renaming it to something that you can easily back), and make sure your system doesn't do any funny stuff. In particular I'd make sure that your computer continues to boot after a restart. Once you're sure, you can do an apt-get remove.

Also, a general good practice, but a particularly good one if you have more than one python interpreter installed, is when installing packages to use python -m pip rather than just pip.

Rory Browne
  • 627
  • 1
  • 5
  • 11
  • Yes, Python 3.9 went to a temp directory. This is all good advice. Thank you –  Apr 03 '21 at 13:50
0

Since you have conda installed, you can create a conda environment that is purely python 3.9.

(base) conda create --name py39 python=3.9
(base) conda activate py39

Note that you can install specific packages for this environment in the first command. For example, add numpy after the 3.9 to include interactive python (conda create --name py39 python=3.9 numpy). You will see that you are no longer using base but py39 environment. If you need to switch to python 3.8, you can deactivate

(py39) conda deactivate

This page can be helpful as it explains environments in details: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

astrochun
  • 1,642
  • 2
  • 7
  • 18
  • It got Python 3.9 working. However, I am doing this to install simlord. I still get the UnsatisfiableError. See post with new linked screenshot. –  Apr 03 '21 at 14:11
  • That's not a surprise given the list of allowed python installations. . In fact it seems to not work with 3.9 stable distribution but should work with 3.8.x – astrochun Apr 03 '21 at 19:18
  • Admittedly, I was only successful at changing the Python version. but it still throws that same error. https://stackoverflow.com/questions/66934411/conda-install-c-bioconda-simlord-unsatisfiederror What is a stable version? –  Apr 03 '21 at 19:23
  • The docs are very specific and given the last release of `simlord` was more than a year ago, it's not a surprise that it was not tested for 3.9. Are you saying 3.8 does not work? I ask because your other questions specifically say 3.9 – astrochun Apr 03 '21 at 19:28
  • Yeah, it doesn't work for 3.8 or 3.9 (same error) –  Apr 03 '21 at 19:33
  • Can you link me to where it lists stable versions in the docs, please? I can't find it –  Apr 03 '21 at 19:41
  • Sorry, I had a typo. It should have been "the docs are NOT very specific. I'll respond to your other question since that post refers to dependency issues while this one focuses on getting the python 3.9 going. – astrochun Apr 03 '21 at 19:50