My environment doesn't load

ftg at lutix.org ftg at lutix.org
Tue Oct 9 05:16:53 EDT 2018


Here are the ouput during sourcing:

> [ftg @ localhost] [/var/www/ffablob]
> % source env-p3/bin/activate 
> [ftg @ localhost] [/var/www/ffablob]
> % which python 
> /usr/bin/python

and if I run some of my code that import beautyfulsoup it fails (python mycode.py), althoug running
directly ./env-p3/python3.5 mycode.py is working...
> 
> October 9 2018 11:06 AM, "Thomas Jollans" <tjol at tjol.eu> wrote:
> 
>> On 2018-10-09 10:36, ftg at lutix.org wrote:
>> 
>>> Thx,
>>> 
>>> initially the env was created with virtualenv yes, and then I copied the folder of the project on a
>>> remote server. I am using zsh (both locally and remotely).
>>> My PATH env variable does includes well the path of my env bin. In this folder there are symbolic
>>> links.
>>> And yes there is well an /env/bin/python in there:
>> 
>> But can you run it?
>> 
>> If it exists, and it's at the top of your PATH, then everything should
>> be fine unless your shell's command hash table is getting in the way -
>> which it shouldn't. virtualenv knows about those:
>> 
>> % tail -6 bin/activate
>> # This should detect bash and zsh, which have a hash command that must
>> # be called to get it to forget past commands. Without forgetting
>> # past commands the $PATH changes we made may not be respected
>> if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
>> hash -r 2>/dev/null
>> fi
>> 
>>> drwxrwxr-x 3 ftg ftg 4096 Jul 6 21:38 .
>>> drwxrwxr-x 6 ftg ftg 4096 May 29 20:33 ..
>>> -rw-rw-r-- 1 ftg ftg 2114 May 29 20:30 activate
>>> -rw-rw-r-- 1 ftg ftg 1056 May 29 20:30 activate.csh
>>> -rw-rw-r-- 1 ftg ftg 2210 May 29 20:30 activate.fish
>>> -rw-rw-r-- 1 ftg ftg 1137 May 29 20:30 activate_this.py
>>> -rwxrwxr-x 1 ftg ftg 276 Jul 6 21:38 chardetect
>>> -rwxrwxr-x 1 ftg ftg 318 May 29 20:33 django-admin
>>> -rwxrwxr-x 1 ftg ftg 176 May 29 20:33 django-admin.py
>>> -rwxrwxr-x 1 ftg ftg 9267 Jul 6 21:38 dumppdf.py
>>> -rwxrwxr-x 1 ftg ftg 285 May 29 20:30 easy_install
>>> -rwxrwxr-x 1 ftg ftg 285 May 29 20:30 easy_install-3.5
>>> -rwxrwxr-x 1 ftg ftg 2438 Jul 6 21:38 latin2ascii.py
>>> -rwxrwxr-x 1 ftg ftg 5970 Jul 6 21:38 pdf2txt.py
>>> -rwxrwxr-x 1 ftg ftg 267 May 29 20:30 pip
>>> -rwxrwxr-x 1 ftg ftg 267 May 29 20:30 pip3
>>> -rwxrwxr-x 1 ftg ftg 267 May 29 20:30 pip3.5
>>> drwxrwxr-x 2 ftg ftg 4096 Jul 6 21:38 __pycache__
>>> lrwxrwxrwx 1 ftg ftg 7 May 29 20:30 python -> python3
>>> -rwxrwxr-x 1 ftg ftg 4743656 May 29 20:30 python3
>>> lrwxrwxrwx 1 ftg ftg 7 May 29 20:30 python3.5 -> python3
>>> -rwxrwxr-x 1 ftg ftg 2373 May 29 20:30 python-config
>>> -rwxrwxr-x 1 ftg ftg 264 May 29 20:30 wheel
>>> 
>>> So I guess that copying an environment is not "creating" it remotely.
>>> However it works in a certain point of view because apache can find it an use it as python-path is
>>> set for my WSGI Daemon Process.
>>> DOn't understand...
>>> 
>>> October 9 2018 10:18 AM, "Thomas Jollans" <tjol at tjol.eu> wrote:
>>>> On 09/10/2018 09:20, ftg at lutix.org wrote:
>>>> 
>>>>> Hello,
>>>>>> I have rsynced a folder on my distant server. Now I try to source my environment: source
>>>>> 
>>>>> ./env/bin/activate and nothing happens.
>>>>> When type > which python, /usr/bin/python is still printed. What could be the issue?
>>>>>> Thanks
>>>> 
>>>> What shell are you using? Was the environment created by virtualenv, venv or something else? After
>>>> sourcing activate, what is your PATH? Is there a ./env/bin/python? Does it work?
>>>> 
>>>> (The hopefully easy fix is obviously to just recreate the environment locally from your
>>>> requirements.txt, assuming you have one)
>>>> -- https://mail.python.org/mailman/listinfo/python-list
>> 
>> --
>> Thomas Jollans
>> 
>> m ☎ +31 (6) 42630259
>> e ✉ tjol at tjol.eu
>> --
>> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list