How to do Python development on Linux Mint?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
bendyer
Level 1
Level 1
Posts: 3
Joined: Tue Jul 02, 2019 6:53 am

How to do Python development on Linux Mint?

Post by bendyer » Sun Jul 14, 2019 12:22 am

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.)

User avatar
AndyMH
Level 8
Level 8
Posts: 2291
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: How to do Python development on Linux Mint?

Post by AndyMH » Sun Jul 14, 2019 3:35 am

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.
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 3 x Thinkpad T430 Cinnamon 19.0, i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate

gm10
Level 18
Level 18
Posts: 8247
Joined: Thu Jun 21, 2018 5:11 pm

Re: How to do Python development on Linux Mint?

Post by gm10 » Sun Jul 14, 2019 4:00 am

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
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

bendyer
Level 1
Level 1
Posts: 3
Joined: Tue Jul 02, 2019 6:53 am

Re: How to do Python development on Linux Mint?

Post by bendyer » Mon Jul 15, 2019 4:52 am

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.)

Post Reply

Return to “Newbie Questions”