0

I upgraded my system from Ubuntu 18.04 to 20.04. On the 18.04 system, I had no issues creating virtual environments. I have an existing Django project and I am trying to create a virtualenv with a new python version, 3.8. But now, I have run into a snag.

My session:

$ mkvirtualenv -a /home/mark/python-projects/new_hopirockets_website -p /usr/bin/python3.8 new_hopi_rockets_website
    ERROR: virtualenvwrapper could not find /usr/share/virtualenvwrapper/virtualenvwrapper.sh in your path

$ echo $PATH
    /usr/local/lib/nodejs/node-v12.4.0-linux-x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/virtualenvwrapper
    
$ ls -alh /usr/share/virtualenvwrapper/virtualenvwrapper.sh
    -rw-r--r-- 1 root root 41K Sep  3  2019 /usr/share/virtualenvwrapper/virtualenvwrapper.sh
    
$ export PATH=$PATH:/usr/share/virtualenvwrapper/virtualenvwrapper.sh
    
$ echo $PATH
    /usr/local/lib/nodejs/node-v12.4.0-linux-x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/virtualenvwrapper:/usr/share/virtualenvwrapper/virtualenvwrapper.sh
    
$ mkvirtualenv -a /home/mark/python-projects/new_hopirockets_website -p /usr/bin/python3.8 new_hopi_rockets_website
    ERROR: virtualenvwrapper could not find /usr/share/virtualenvwrapper/virtualenvwrapper.sh in your path
    
$  /usr/bin/python3.8
Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

$ ls /home/mark/python-projects/new_hopirockets_website
 articles                               fred                               new_hopi_rockets_website.wpr   run.sh
 bugs_new_hopirockets_website.ods       full_text_search                   new_hopi_rockets_website.wpu   sam.txt
 check.txt                              gallery                            old_gallery3                   setup
 contact                                get_archive_data_from_tsunami.sh  'old stuff'                     simulation
 cp_tsunami-hopirockets_to_octopus.sh   hit_counters                       payload_separated.txt          soft-ui-dashboard
 cp_tsunami_to_octopus.sh               hopirockets                        __pycache__                    static
 database                               __init__.py                        README.txt                     test.sh
 DataTables                             launchdate                         requirements                   utils
 flights                                manage.py                          rsync_logs                     viewcount
$

I forgot to include a section from my .bashrc file:

# For virtualenv and mkvirtualenv
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/share/virtualenvwrapper/virtualenvwrapper.sh
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh

I am not sure what is going on here.

Thanks in advance for your help!

user1045680
  • 815
  • 2
  • 9
  • 19
  • I could be mistaken, but I would have expected the shell script to be executable. Maybe try `chmod +x /usr/share/virtualenvwrapper/virtualenvwrapper.sh`? – sytech Aug 22 '22 at 21:59
  • When I upgraded to Ubuntu 20.04, I made a copy of the whole system in case I needed any config files. I checked in the 18.04 backup, and the permissions and location of the virtualenvvwrapper.sh file as identical to the 20.04 system as written above. I also updated the original post to include the bits from my .bashrc file. – user1045680 Aug 23 '22 at 02:24
  • If you use a modern version of Python (3.3+) consider switching to [`venv`](https://docs.python.org/3/library/venv.html) from the standard library https://stackoverflow.com/a/47559925/548562 – Iain Shelvington Aug 23 '22 at 02:32

0 Answers0