No module named virtualenvwrapper; virtualenv - python

I have used virtualenvwrapper for some months now, and today I installed python2.6 from source to use tox.
All of a sudden I get:
$ cdwebapi
/usr/local/bin/python: No module named virtualenvwrapper
/usr/local/bin/python: No module named virtualenvwrapper
/usr/local/bin/python: No module named virtualenvwrapper
/usr/local/bin/python: No module named virtualenvwrapper
Wrapper is installed:
$ sudo pip install virtualenvwrapper
The directory '/home/cchilders/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/cchilders/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): stevedore in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pbr>=1.6 in /usr/local/lib/python2.7/dist-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /home/cchilders/.local/lib/python2.7/site-packages (from stevedore->virtualenvwrapper)
If I try to source again:
$ src
/usr/local/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is
set properly.
--no-deps: command not found
This is what I sourced:
# VIRTUALENVWRAPPER
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/work_projects
source /usr/local/bin/virtualenvwrapper.sh
export PATH=$PATH:/usr/local/bin/virtualenvwrapper.sh
My venv still exists:
$ which python
/home/cchilders/.virtualenvs/mysite/bin/python
(mysite) cchilders:~/work_projects/core/unver/mysite (master)
$ which pip
/home/cchilders/.virtualenvs/mysite/bin/pip
Changing bashrc to:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/work_projects
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
export PATH=$PATH:/usr/local/bin/virtualenvwrapper.sh
causes:
$ cdwebapi
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper')
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper')
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper')
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper')
I just removed and reinstalled virtualenvwrapper and same issue. How can I calm these messages and fix the wrapper? Thank you

Related

virtualenv env bash: virtualenv: command not found

I have a problem each time I want to start my VM even after Installing on windows
`
$ pip install virtualenv
Collecting virtualenv
Using cached virtualenv-20.16.6-py3-none-any.whl (8.8 MB)
Requirement already satisfied: platformdirs<3,>=2.4 in c:\users\samib\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from virtualenv) (2.5.2)
Requirement already satisfied: distlib<1,>=0.3.6 in c:\users\samib\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from virtualenv) (0.3.6)
Requirement already satisfied: filelock<4,>=3.4.1 in c:\users\samib\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from virtualenv) (3.8.0)
Installing collected packages: virtualenv
WARNING: The script virtualenv.exe is installed in 'C:\Users\samib\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed virtualenv-20.16.6
`
I have the error
virtualenv env bash: virtualenv: command not found
I tried to uninstall and install again but I have the same issue

ModuleNotFoundError: No module named 'pygam'

I'm trying to execute a python script which pygam ( from pygam import LogisticGAM, LinearGAM
).
when I'm trying to execute this script  I have this error:
ModuleNotFoundError: No module named 'pygam'
The problem that pygam is installed with both pip and pip3.
This the result when I try to re-install it using pip:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: The directory '/home/mobelite/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/mobelite/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pygam in /usr/local/lib/python2.7/dist-packages (0.8.0)
Requirement already satisfied: scipy in /usr/local/lib/python2.7/dist-packages (from pygam) (1.2.2)
Requirement already satisfied: future in /usr/local/lib/python2.7/dist-packages (from pygam) (0.17.1)
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from pygam) (1.16.5)
Requirement already satisfied: progressbar2 in /usr/local/lib/python2.7/dist-packages (from pygam) (3.47.0)
Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from progressbar2->pygam) (1.12.0)
Requirement already satisfied: python-utils>=2.3.0 in /usr/local/lib/python2.7/dist-packages (from progressbar2->pygam) (2.3.0)
and this is the result when I try to re-install them using pip3:
The directory '/home/mobelite/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mobelite/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): pygam in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied (use --upgrade to upgrade): future in /usr/local/lib/python3.5/dist-packages (from pygam)
Requirement already satisfied (use --upgrade to upgrade): progressbar2 in /usr/local/lib/python3.5/dist-packages (from pygam)
Requirement already satisfied (use --upgrade to upgrade): numpy in ./.local/lib/python3.5/site-packages (from pygam)
Requirement already satisfied (use --upgrade to upgrade): scipy in ./.local/lib/python3.5/site-packages (from pygam)
Requirement already satisfied (use --upgrade to upgrade): python-utils>=2.3.0 in /usr/local/lib/python3.5/dist-packages (from progressbar2->pygam)
Requirement already satisfied (use --upgrade to upgrade): six in ./.local/lib/python3.5/site-packages (from progressbar2->pygam)
You are using pip version 8.1.1, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I found this is normal because I just install it, but I don't understand why they don't see pygam
Make sure you have the right versions of python and pip.
Try installing it again with python (with the correct version) you are using to run the script.
For example, you want to run it with [yhon3.5 use the below command:
python3.5 -m pip install pygam
I am assuming python3.5 in the above command invokes Python 3.5, on my system I have python3 invoke Python 3.5
Give the install a try with sudo as well
sudo pip install pygam
# OR
sudo pip3 install pygam
pip -V command will you the currently running version of pip and the python version it is installed in.
Example:
pip -V
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
pip3 -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
The above comes handy if multiple versions of python are installed on a system.
Let us know if it helps.
Make sure you are not using virtual environment, you must install pygame, just run the following command:
pip install pygame
Install it and try again. More information visit https://pypi.org/project/pygame/

Why am I getting error while installing opencv on Raspberrypi3

As I said I'm getting error while installing Open cv on Raspberry pi3 I'm following instruction from pyimagesearch. I get error as follow
pi#raspberrypi:~ $ sudo python get-pip.py
Collecting pip
Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 72kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.3
pi#raspberrypi:~ $ sudo python3 get-pip.py
Collecting pip
Using cached pip-9.0.3-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.3
pi#raspberrypi:~ $ sudo pip install virtualenv virtualenvwrapper
Collecting virtualenv
Downloading virtualenv-15.2.0-py2.py3-none-any.whl (2.6MB)
100% |████████████████████████████████| 2.6MB 47kB/s
Collecting virtualenvwrapper
Downloading virtualenvwrapper-4.8.2-py2.py3-none-any.whl
Collecting stevedore (from virtualenvwrapper)
Downloading stevedore-1.28.0-py2.py3-none-any.whl
Collecting virtualenv-clone (from virtualenvwrapper)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Collecting pbr!=2.1.0,>=2.0.0 (from stevedore->virtualenvwrapper)
Downloading pbr-4.0.2-py2.py3-none-any.whl (98kB)
100% |████████████████████████████████| 102kB 278kB/s
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3/dist-packages (from stevedore->virtualenvwrapper)
Installing collected packages: virtualenv, pbr, stevedore, virtualenv-clone, virtualenvwrapper
Successfully installed pbr-4.0.2 stevedore-1.28.0 virtualenv-15.2.0 virtualenv-clone-0.3.0 virtualenvwrapper-4.8.2
pi#raspberrypi:~ $ sudo rm -rf ~/.cache/pip
pi#raspberrypi:~ $ export WORKON_HOME=$HOME/.virtualenvs
pi#raspberrypi:~ $ source /usr/local/bin/virtualenvwrapper.sh
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
pi#raspberrypi:~ $ echo -e "\n# virtualenv and virtualenvwrapper" >> ~/.profile
pi#raspberrypi:~ $ echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.profile
pi#raspberrypi:~ $ echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
pi#raspberrypi:~ $ source ~/.profile
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
pi#raspberrypi:~ $ mkvirtualenv cv -p python2
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/pi/.virtualenvs/cv/bin/python2
Also creating executable in /home/pi/.virtualenvs/cv/bin/python
Installing setuptools, pip, wheel...done.
/usr/bin/python: No module named virtualenvwrapper
pi#raspberrypi:~ $ mkvirtualenv cv -p python3
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/pi/.virtualenvs/cv/bin/python3
Not overwriting existing python script /home/pi/.virtualenvs/cv/bin/python (you must use /home/pi/.virtualenvs/cv/bin/python3)
Installing setuptools, pip, wheel...done.
/usr/bin/python: No module named virtualenvwrapper
pi#raspberrypi:~ $ source ~/.profile
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
I get error as virtualenvwrapper.sh: There was a problem running the initialization hooks. How can I fix this error? I can't figure out why am I getting this error. I searched google It didn't fix my issue.I keep getting bash: /usr/local/bin/python3: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 and that PATH is
set properly.
How can I fix this ? I tried to uninstall and reinstalling virtualenv it didn't workout.Do I need to reinstall software and begin from the start? Which takes a lot of time especially in raspberrypi I don't want to do this, help me to fix this problem

win 8.1 cygwin - pip is installing into windows python directory?

I have recently just started the foray into running cygwin on windows.
Attempting to setup a development environment, and noticing some oddities.
so for example, I have installed virtualenvwrapper but when i open a new cygwin terminal i get (after setting appropriate lines in my .bashrc)
-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
so i attempt to reinstall virtualenvwrapper using pip and i get
$ pip install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in c:\python27\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in c:\python27\lib\site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in c:\python27\lib\site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in c:\python27\lib\site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): argparse in c:\python27\lib\site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in c:\python27\lib\site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pbr!=0.7,<1.0,>=0.6 in c:\python27\lib\site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pip in c:\python27\lib\site-packages (from pbr!=0.7,<1.0,>=0.6->stevedore->virtualenvwrapper)
What gives? why is it installing it to the windows directory? sure enough i can see virtualenvwrapper is not installed in c:/cygwin64/lib/Python2.7/site-packages/
in fact that directory is completely bare.
I expected to see the updated version of pip i installed. it's of course in the windows directory.
I had previously installed virtualenvwrapper via pip on windows, but my understanding is that the windows environment and the cygwin terminal are totally seperate and shouldn't know about each other(?)
as you might expect this is also wrecking havoc with other packages.
for example attempting to install uwsgi i get this error:
Collecting uWSGI==2.0.7 (from -r _pip/requirements.txt (line 52))
Downloading uwsgi-2.0.7.tar.gz (772kB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "c:\cygwin64\tmp\pip-build-n5cvur\uWSGI\setup.py", line 3, in <module>
import uwsgiconfig as uc
File "uwsgiconfig.py", line 8, in <module>
uwsgi_os = os.uname()[0]
AttributeError: 'module' object has no attribute 'uname'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\cygwin64\tmp\pip-build-n5cvur\uWSGI
which i understand is because os.uname doesn't exist on windows. Why is the pip installer running setup using windows python?
------- update -------
I think i found the root cause
$ which pip
/c/Python27/Scripts/pip
so my questions are:
why is pip the windows one by default? or how did this happen?
-------- Update 2 ----------
i just discovered that the default PATH env variable in cygwin appends the windows one. sure enough the path to the windows pip is there.
$ echo $PATH
Is this expected? if so, why is this desireable? doesn't it increase the chance of unintentional conflicts like this one?
So I'll just leave this here as a warning to n00bs like myself.
cygwin appends the windows path to the cygwin terminal PATH env variable.
if you already have pip installed on windows and it is on your path it will work but with unexpected results like above.
to check make sure you do
which python
which pip
to confirm what version you are running.
only python 2.7.9 and up include pip by default and the package included in cygwin isn't there yet. so you will most likely need to install pip manually
if you had a cygwin terminal open, you will need to close all windows otherwise it remembers the path to the windows pip.
See this answer to setup easy_install in cygwin's python install.
https://serverfault.com/questions/7282/how-to-run-easy-install-in-cygwin
Once that is done, you can use easy_install to get pip.

Virtualenvwrapper installation snow leopard python

I am trying to configure virtualenvwrapper with django1.4. I am following this post and am trying to do what it says there:
Admin$ pip install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Admin$ export WORKON_HOME=$HOME/.virtualenvs
Admin$ export PROJECT_HOME=$HOME/Users/Admin
Admin$ source /usr/local/bin/virtualenvwrapper.sh
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
Admin$ mkvirtualenv --python=python2.7 mynewenv
The executable /Users/Admin/python2.7 (from --python=/Users/Admin/python2.7) does not exist
Can anyone help me figure out how to get virtualenvwrapper set up on my osx snow leopard installation? Thanks so much for the help!
It looks like you're trying to use python2.7, but you haven't told virtualenvwrapper about that. Try adding export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7 (assuming that's where your python2.7 install is located) before source /usr/local/bin/virtualenvwrapper.sh - i.e.
Admin$ export WORKON_HOME=$HOME/.virtualenvs
Admin$ export PROJECT_HOME=$HOME/Users/Admin
Admin$ export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
Admin$ source /usr/local/bin/virtualenvwrapper.sh

Categories

Resources