Page 1 of 1

How to do Python development on Linux Mint?

Posted: Sun Jul 14, 2019 12:22 am
by bendyer
I am a beginner at Linux/Linux Mint and a beginner at setting up a Python project. On say Windows I would just install the Python version I wanted, install venv, and then start adding dependencies with pip from the virtual environment. I'm not sure what I should do on Mint which has preinstalled Python, so I'd like to know what are good practices for setting up a Python developer environment on Linux Mint (or maybe what are some bad practices I should make sure to avoid).

I had been using Mint 18.3 Cinnamon a while, but recently got started on a fresh installation of 19.1. Here are some things I felt uncertain about:
  1. On 18.3 I wanted to install tensorflow, and I read (somewhere...) it was not recommended to install Anaconda on Linux Mint. (Here is another user worried about the same thing: https://unix.stackexchange.com/question ... led-python).
  2. On 19.1 I tried to install the virtualenv module, I get these same problems (https://stackoverflow.com/questions/342 ... linux-mint).
  3. I might want to work with Python 3.7 instead of 3.6 which I have now, but I don't know if I can or should do this globally (cf. https://www.reddit.com/r/linuxmint/comm ... inux_mint/)
  4. I remember having used "python3 --user <command>" at times to avoid the first problem (I think this was mentioned here in the context of installing anaconda: https://www.linuxquestions.org/question ... 175652390/).

My understanding is that because Mint is written partially in Python, it's not good to modify the global version of python too much. My apologies in advance if this question is too broad. Maybe a better specific question would be:

Could those on here who do python development share how they would go about setting up a project on Linux Mint?

(I know this depends on the project & dependencies, but some general guidelines would be very helpful. If you could describe how you would get setup from a fresh Mint installation (say of Mint 19.1) I would be grateful.)

Re: How to do Python development on Linux Mint?

Posted: Sun Jul 14, 2019 3:35 am
by AndyMH
I've dabbled in python, certainly not a regular user. You can install pip from software manager, both for v2.7 and v3 and then install packages as normal.

You will want an IDE, I've used IDLE, again in software manager in both 2.7 and 3.6 versions. There will be other more regular users here who can probably recommend a better IDE.

Re: How to do Python development on Linux Mint?

Posted: Sun Jul 14, 2019 4:00 am
by gm10
Yes, leave the system-default version alone, a recipe for disaster.

Python 3.3+ has virtual environments built in:
https://docs.python.org/3/library/venv.html

Re: How to do Python development on Linux Mint?

Posted: Mon Jul 15, 2019 4:52 am
by bendyer
I decided to try out using pyenv. I'm leaving pyenv global to be the system python, then on a particular project I change to a local python version. (I don't know if something bad happens if I change the global pyenv version.)