Raspberry Pi VIRTUAL_ENV_BIN_DIR for version 5

55 views
Skip to first unread message

Eewec

unread,
Oct 8, 2020, 12:27:32 PM10/8/20
to virtualenvwrapper
Hi,

I'm new to all things Raspberry Pi. When installing virtualenvrapper it automatically installs version 5.

When trying to use mkvirtualenv I kept getting an error that the destination address didn't contain an activate script.

Looking at the virtualenvwrapper.sh it's not checking if it's set to anything already and thus setting it to "/usr/local/bin", however when it makes the layout for the virtual environment it doesn't actually make the directory structure. It just makes "{virtualdirectory}/bin". Thus it's looking in the wrong place and finding nothing.

I've edited my .sh file to first check if it's already been set and only set it if it's "".

Seems everyone else is just rolling back to 4.8.4

Eewec

Eewec

unread,
Oct 8, 2020, 1:46:48 PM10/8/20
to virtualenvwrapper
So, just finished copying what I changed into a log file for my own use in setting up the next one.

Here's a copy of the altered code;

if [ "${VIRTUALENVWRAPPER_ENV_BIN_DIR:-}" = "" ]
    VIRTUALENVWRAPPER_ENV_BIN_DIR="usr/local/bin"
    if [ "${OS:-}" = "Windows NT" ] && ([ "${MSYSTEM:-}" = "MINGW32" ] || [ "${MSYSTEM:-}" = "MINGW64" ])
    then
        # Only assign this for msys, cygwin use standard Unix paths
        # and its own python installation
        VIRTUALENVWRAPPER_ENV_BIN_DIR="Scripts"
    fi
fi

I just wrapped the original code in an if statement and set VIRTUALENVWRAPPER_ENV_BIN_DIR in the .bashrc and ,profile files for the user to 'bin' (without the two ') which is where mkvirtualenv puts the scripts.

Eewec

unread,
Oct 11, 2020, 9:20:37 AM10/11/20
to virtualenvwrapper
Huh, just noticed I missed out a 'then' statement between the initial if statement and the setting of and empty string. Make sure to put that in.

if [ "${VIRTUALENVWRAPPER_ENV_BIN_DIR:-}" = "" ]
then
    VIRTUALENVWRAPPER_ENV_BIN_DIR="usr/local/bin" 

Eewec

unread,
Oct 11, 2020, 10:13:31 AM10/11/20
to virtualenvwrapper
OK, so there's more issues with the bin path. Seems the hooks that make the predeactivate, postdeactivate, preactivate, postactivate and get_env_details are still looking in the wrong place to create them instead of using VIRTUALENVWRAPPER_ENV_BIN_DIR. As the /usr/local/bin directory doesn't exist it doesn't make those files, even though it actually tells you it made predeactivate in that location. It's what clued my in to realizing it was still not behaving.

Doug Hellmann

unread,
Oct 11, 2020, 11:50:57 AM10/11/20
to virtuale...@googlegroups.com
Could you post the actual error message? I don’t know what “destination address” might mean here.

Which version of python do you have installed and where is it?

What is the value of VIRTUALENVWRAPPER_PYTHON after you source virtualenvwrapper.sh?

--
You received this message because you are subscribed to the Google Groups "virtualenvwrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to virtualenvwrap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/virtualenvwrapper/ad9e71ba-6cdf-4106-afb2-f3ffb1abefbdn%40googlegroups.com.

Eewec

unread,
Oct 11, 2020, 4:54:15 PM10/11/20
to virtualenvwrapper
It's Python 3.7 and the "destination address" is where mkvirtualenv is trying to make the virtualenvironment, in this vase venv3 in ~/.virtualenvs
typing;

mkvirtualenv venv3

creates /venv3 perfectly fine. it then creates /venv3/bin and /venv3/lib/python3.7/site-packages and all those sub directories. What it *never* does is make /venv3/usr/local/bin at least not on Raspbian Buster

So when version 5.0.0 is looking for /venv3/usr/local/bin/activate (which it put in /venv3/bin) it fails. Overriding that with my code above and setting VIRTUALENVWRAPPER_ENV_BIN_DIR to bin works at getting it to actually seem to succeed, but then it doesn't make  predeactivate and the others. It tries putting those in /venv3/usr/local/bin/ even though it doesn't exist, and while it says the first one works, it doesn't try for the others.

Doug Hellmann

unread,
Oct 12, 2020, 3:33:43 AM10/12/20
to virtuale...@googlegroups.com

The 5.0.0 release is broken and was retracted. The distribution you’re using should not have shipped it. :(

I suggest removing the system package for virtualenvwrapper, installing it via pip, and filing a bug with the distribution to remove the bad package. 

On Oct 11, 2020, at 4:54 PM, Eewec <eewec....@gmail.com> wrote:

It's Python 3.7 and the "destination address" is where mkvirtualenv is trying to make the virtualenvironment, in this vase venv3 in ~/.virtualenvs

Eewec

unread,
Oct 12, 2020, 7:25:18 AM10/12/20
to virtualenvwrapper
If I type

sudo pip3 install virtualenvwrapper

I get version 5.

That's using the standard Raspbian distro from the Raspberry Pi website.

Have to type

sudo pip3 install virtualenvwrapper=='4.8.4'

Seems something is hinky.

Doug Hellmann

unread,
Oct 12, 2020, 9:44:47 AM10/12/20
to virtuale...@googlegroups.com
I don’t know how Raspian configures pip. Could it be configured to look at a PyPI mirror? 

There is no 5.0.0 release visible on PyPI.org and when I run “pip3 install virtualenvwrapper” I get 4.8.4.

Eewec Ourbyni

unread,
Oct 12, 2020, 12:53:14 PM10/12/20
to virtuale...@googlegroups.com
Currently setting up a test SD card to see what I can find out. Not going to change my main card as that's now working and I don't want to ruin that after how long it took to get something else to install correctly.

Doug Hellmann

unread,
Oct 12, 2020, 1:33:38 PM10/12/20
to virtuale...@googlegroups.com
Sounds good. Let me know how it goes!

On Oct 12, 2020, at 12:52 PM, Eewec Ourbyni <eewec....@gmail.com> wrote:

Currently setting up a test SD card to see what I can find out. Not going to change my main card as that's now working and I don't want to ruin that after how long it took to get something else to install correctly.

--
You received this message because you are subscribed to the Google Groups "virtualenvwrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to virtualenvwrap...@googlegroups.com.

Eewec Ourbyni

unread,
Oct 12, 2020, 3:52:06 PM10/12/20
to virtuale...@googlegroups.com
OK, finally got the thing updated etc. Here's a pic of installing virtualenvwrapper;

Hope that helps sort it out.
20201012_204959.jpg

Doug Hellmann

unread,
Oct 12, 2020, 4:25:22 PM10/12/20
to virtuale...@googlegroups.com
It’s downloading the 5.0.0 package from piwheels.org, which is a caching server for packages pre-compiled for the raspberrypi/arm platform. Pip is finding the newer version and preferring it over the older one on PyPI.

--
You received this message because you are subscribed to the Google Groups "virtualenvwrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to virtualenvwrap...@googlegroups.com.

Doug Hellmann

unread,
Oct 12, 2020, 6:00:13 PM10/12/20
to virtuale...@googlegroups.com
The admin responded to the bug report and removed the package, so you should be all set.

Eewec Ourbyni

unread,
Oct 12, 2020, 6:10:51 PM10/12/20
to virtuale...@googlegroups.com
Glad I could help find the issue. Now peeps won't be wondering why things don't work properly, That's been up there for a long time judging by the threads that I found about the issue while trying to work out how to fix what I thought was an issue at my end.


Just as some examples of others who had this issue themselves. They're from about 7 months ago.


You received this message because you are subscribed to a topic in the Google Groups "virtualenvwrapper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/virtualenvwrapper/BGVRmTY0MLY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to virtualenvwrap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/virtualenvwrapper/F202B07F-ABFD-4CAF-A6EC-858F39548443%40doughellmann.com.
Reply all
Reply to author
Forward
0 new messages