What can I do about this?

Roel Schroeven roel at roelschroeven.net
Mon Aug 29 05:19:42 EDT 2022


Op 29/08/2022 om 2:55 schreef gene heskett:
> On 8/28/22 19:39, Peter J. Holzer wrote:
>> On 2022-08-28 18:40:17 -0400, gene heskett wrote:
>>> Persuant to my claim the py3.10 is busted, here is a sample. This is 
>>> me,
>>> trying to make
>>> pronterface, inside a venv: When the package manager version will 
>>> only run
>>> the gui-less "pronsole"
>>> but nothing else from that all python kit runs as it should or at all.
>>>  From the package-managers install in /usr/share/doc/printrun-common/ I
>>> copied requirements.txt
>>> into the venv, and ran this command line:
>>>
>>> gene at rock64:~/venv$ pip3 install -r requirements.txt
>> You are almost certainly *not* in a venv here. First, your prompt
>> doesn't show the name of the venv,
> I've created that several times, as octoprint won''t run without it 
> either.
> I found a way to autostart it on reboots and octoprint seems happy 
> with it
I agree with Peter: it doesn't look as if you are invoking the pip3 in 
the venv. Just making the venv-directory the current directory doesn't 
activate it.

As a diagnostic, ask the OS which pip3 is actually used:

$ type -a pip3

Does that show the pip3 installed in the venv? Or the system-wide one? 
If it's not the pip3 in the venv, well, then that's the problem (or at 
least part of the problem). Solution: first check whether the venv 
really contains 'pip3' (as opposed to eg. just 'pip'): list the contents 
of the bin subdirectory of the venv. If not, use 'pip' or whatever 
instead. Then to make sure you use the one in the venv, either activate 
the venv or explicitly specify the path when invoking pip/pip3 (and 
likewise for python/python3).

So either (assuming you're using bash):

$ source {path_to_venv}/bin/pip3  # activate the venv
$ type -a pip3  # check whether now the correct pip3 is used
$ pip3 install -r requirements.txt  # finally invoke pip3

or:

$ {path_to_venv}/bin/pip3 install -r requirements.txt

Activating the venv is easier if you're going to use multiple commands 
in the venv. Note that activating the venv only has effect on the 
current shell; other shells are unaffected, and when you close the 
current shell the venv is not activated anymore.
Explicitly using the path is easier for one-off calls, or in things like 
crontab.

-- 
"There is no cause so noble that it will not attract fuggheads."
         -- Larry Niven



More information about the Python-list mailing list