python-virtualenvwrapper / virtualenvwrapper

Other
120 stars 17 forks source link

virtualenvwrapper could not find virtualenv in your path #73

Closed trollkarlen closed 1 week ago

trollkarlen commented 1 year ago

On MacOs 13.5 with Python 3.11.4 virtualenv==20.24.3 virtualenv-clone==0.5.7 virtualenvwrapper==4.8.4

When you install(--user) virtualenv as dependencie to virtualenvwrapper and/or by itself then there is no virtualenv script generated in bin. Its installed so you can run it with python3 -m virtualenv ... and you cant set

VIRTUALENVWRAPPER_VIRTUALENV="python3 -m virtualenv"

But then it fails with:

$ mkvirtualenv openstack
-bash: python3 -m virtualenv: command not found

So there seams to be some issue in how the two packages installs and handle this that does not support each other.

Also when the env is created the virtualenvwrapper.hook_loader complains about virtualenvwrapper not being installed in the virtualenv, dont know where this issue resides here or in virtualenv.

dhellmann commented 8 months ago

I have virtualenv installed in my user directory and I see

$ which virtualenv
/Users/dhellmann/.local/bin/virtualenv

Maybe you need to add a directory to your $PATH?

carltongibson commented 2 weeks ago

I saw a similar issue installing with pipx. One needs to pass the --include-deps flag to install in order to have those commands added the bin folder exposed on PATH.

Either way, this is definitely a PATH issue and can probably be closed.

dhellmann commented 1 week ago

This ticket has been open for a while with no response, so I am closing it. Let us know if @carltongibson's suggestion does not help and you are still having this problem.

trollkarlen commented 1 week ago

Sorry been unavailable for a time now. Will test it tomorrow and see if its fixed or a path issue.

trollkarlen commented 1 week ago

I think it was an issue in virtualenv and its fixed now(That it dod not produce "virtualtenv" executable when installed as --user) Also its changed name of the bin to virtualenv2

$ python3 -m pip install --user virtualenv ... $ ls -l "$HOME/bin/virtualenv"* $HOME/bin/virtualenv2 $ VIRTUALENVWRAPPER_VIRTUALENV="$HOME/bin/virtualenv2" mkvirtualenv test2 ... $ workon test2 .. (test2) $

So it must have been an issue with virtualenv wrapper.

But maybe its a nice to have feature that not all of VIRTUALENVWRAPPER_VIRTUALENV env is used as a command so you can use a command with arguments here like: VIRTUALENVWRAPPER_VIRTUALENV="$HOME/bin/python3 -m venv"

But maybe its hard without making have dangerous side effekts, but maybe it already has.

*Edit It works with an somewhat undocumented feature: VIRTUALENVWRAPPER_VIRTUALENV="/opt/homebrew/bin/python3" VIRTUALENVWRAPPER_VIRTUALENV_ARGS="-m venv" mkvirtualenv test3

So maybe som added doc and this can be closed.