Installing Personal Use Python to By Pass VENV

I don’t have anything against VENV but I’m trying to find a way to use Thonny until they get their issues with VENV sorted out.

I’m running on Linux MINT and they don’t recommend globally defeating VENV since this could impact any system level Python programs they have. The alternative they say is to install a personal use version of Python. My system already has 12.8.3 installed at the system level.

My assumption is that if I install and run locally, I will not have VENV enforced; correct?

I just downloaded the TAR file for 3.13.1. I looks like I need to do the following

    ./configure --prefix=/home/paul/.local/bin
    make
    make test
    make install

I dropped the SUDO off the ‘make install’ since it’s local. Is that correct?

Thanks for any confirmation/corrections etc.

Yes, that should be correct. (In fact, “sudo make install” would cause a lot of hassles; it’s definitely better to run it as yourself when installing into your own home directory.)

I had to abandon my install attempts because of lack of knowledge on how to connect things together in the install configure. Specifically, from the output of running configure:

  • OpenSSL 3.0.13 is installed but ssl.h could not be found. I found it in /var/lib/flatpak/runtime/org.freedesktop.Sdk but that does seem like an appropriate directory to use. Also found a _ssh.h in /home/paul/Downloads/Python-3.13.1/Modules which is the extract location.
  • I installed SQLITE3 but it shows as disabled. I was able to open it from a terminal.
  • tkinter is installed. With the existing Python I can successfully run ‘python -m tkinter’. configure shows it as missing.

So I think I’m going to abandon this and use the free version of PyCharm which does with VENV. I prefer Thonny.

@DS256 Lets walk this back a bit and address your first issue. What problem have you experienced using Thonny with a virtual environment.

I just installed it via flatpak, set its interpreter to an existing virtual environment and it seems to be working perfectly fine.

  • How did you install Thonny
  • How did you start Thonny
  • What errors or unexpected behavior are you experiencing
1 Like

Hi Rob. Thanks for taking the asking the question. My Google showed that others were having problems with Thonny with VENV with one comment, which sounded like a Thonny developer, was that they are working on it.

As mentioned, I’m running Linux Mint MATE edition which has a Software Manager. I assume a GUI front end to ‘apt’. I installed Thonny 4.1.6 from there. Python 3.12.3 was already installed with the enforcement of VENVs.

I created an empty directory $HOME/src/test_venv_lm and had Thonny create a new virtual environment in it. That worked and here is how the Interpreter page looked after.

I then went into Manage Packages and tried to search for a package. I received the following error message and the Manage Package was greyed our after.

PROBLEM IN THONNY'S BACK-END: Exception while handling 'get_active_distributions' (ModuleNotFoundError: No module named 'pkg_resources').
See Thonny's backend.log for more info.

Process ended with exit code 1.

That stopped me from progressing and start Googling and my conclusion of broken Thonny.

This time I opened a terminal windows, activated the VENV and was able to use ‘python -m pip {pkg}’ to load the module I needed. It then worked in the Python Program I used in Thonny.

So, thanks to you asking the question, and me looking deeper, I now have a work around I can use.

pkg_resources is a deprecated package which implies that Thonny is running on an incompatible python interpreter.

could you please open a terminal and type python --version

also flatpak list | grep thonny

Also could you confirm your ‘software manager’ looks like the following

it may look a little different, but try searching for thonny

you can see on mine that its installed via flathub (so its a flatpak)

Here you go

paul@ambrotype:~$ python --version
Python 3.12.3

paul@ambrotype:~$ flatpak list | grep thonny
Thonny  org.thonny.Thonny       4.1.4   stable  system

paul@ambrotype:~$

Your on thonny 4.1.4 and im on 4.1.7. I notice in the change log that a fix was made to package search which sounds like it may be the issue your having.

could you open your terminal and try flatpak update

I noted that my system needed an update. When I performed that, Thonny was updated to 4.1.7. Checked that with About Thonny and checking flatpack.

Created a new empty directory for Thonny to put a VENV into but same behavior/error as reported above.

Thanks for finding the information and doing the research.

I have a workable solution/workaround that allows me to use Thonny instead on PyCharm.

1 Like