virtualenvwrapper fails with "No module named Help2Man" - python

I'm trying to install virtualenvwrapper (4.7.2) on El Capitan using
pip install virtualenvwrapper
This is a brew installed python/pip version (python 2.7.12, pip 8.1.2). The installation fails with
...
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named Help2Man
A help2man python module doesn't seem to exist anywhere, I could only find a command line tool with that name. Any ideas?

I was able to fix this thanks to this thread. I had a package installed with invalid distutils.command entry points (in my case obspy 1.0.2 - this seems to be fixed in 1.0.3) which causes this error to pop-up in totally unrelated places.
I uninstalled obspy, installed virtualenvwrapper, then reinstalled obspy

Related

ModuleNotFoundError: No module named 'cryptography'

these are the Error messages I am geeting on running any of my project modules.
Traceback (most recent call last):
File "C:\Users\hsnl\BlockchainCodesTutor\Wallet.py", line 3, in <module>
import Transactions
File "C:\Users\hsnl\BlockchainCodesTutor\Transactions.py", line 2, in <module>
import Signatures
File "C:\Users\hsnl\BlockchainCodesTutor\Signatures.py", line 2, in <module>
import cryptography
ModuleNotFoundError: No module named 'cryptography'
I have already installed the cryptography module and was working perfectly until today I start getting this message that " No module named 'cryptography'".
I have again installed the cryptography as well as pip package but still showing the same error.
There might be loose versions running on your system. Please try the following:
python -m pip uninstall cryptography
python -m pip install cryptography
You can also check out this with python -m to make sure you are not using a loose pip.
You might not have cryptogtaphy installed correctly. I see you are using windows. Open commandline as an administrator and run pip install cryptography again. Enshure that the installation finishes without any errors and consider to restart your python interpreter after installation.
For further help you should post more details like the output of pip and your code leading to the error, so a more detailed answer for your problem can be given.
Try download cryptography whl from here.
Then use pip install cryptography-XXX.whl
For example:
pip install cryptography-3.3.1-cp36-abi3-win_amd64.whl
And now just supports python2.7 and python3.6.

Trouble with ipython notebook after upgrading ubuntu to 17.10

I recently upgraded ubuntu from 16.04 to 17.10.
Afterwards, when I try
sudo pip install jupyter
graphlab-create 2.1 has requirement decorator==4.0.9, but you'll have decorator 4.3.0 which is incompatible.
graphlab-create 2.1 has requirement requests==2.9.1, but you'll have requests 2.18.1 which is incompatible.
Cannot uninstall 'pyzmq'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
When I try running
ipython notebook
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 445, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python2.7/dist-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
ImportError: No module named notebook.notebookapp
Create a separate virtualenv and install Jupyter there. If you still face the same error, downgrade pip. I am assuming you are having pip version 10. You can downgrade by doing pip install pip==9.0.1. Try installing Jupyter now.
If you don't want to downgrade pip, you have to manually remove all those packages, pyzmq in this case, from site-packages directory before installing Jupyter.
Reference: https://github.com/pypa/pip/issues/5247

PyhtonError ImportError: No module named six

I am running Python 2.7.13 on Windows 7, and I got this error:
ImportError: No module named six
But I found six.py and six.pyc in "C:\Python27\Lib\site-package\pip\_vendor\six.py", ""C:\Python27\Lib\site-package\pip\_vendor\six.pyc".
Can I copy this file six.py into my project? Or I must download and install the module named six?
What function does six.py or module named six have?
You can run to make sure if six is properly installed or not,
pip install six
if output says module is already installed and still the problem persists then you can visit and download the wheel file of six module from the link : https://pypi.python.org/pypi/six
To install wheel file again method is same:
pip install wheel_file_name.whl
Yes, you can install six into a python project and for that you don't have to copy the .py or .pyc file of six, for that you have to create a virtual enviroment in the project, follow this link on how to create and manage a virtual environment for python project in windows : http://pymote.readthedocs.io/en/latest/install/windows_virtualenv.html

Mac - Python - import error: "No module named site"

Tonight I am trying to get the package called "requests" installed and have begun fumbling around with the terminal and do not have very much intuition when it comes to this sort of thing.
Computer is a mac mini, osx version 10.9.4
In /Library/Python I have 4 folders: 2.3 2.5 2.6 and 2.7.
In /Applications I have "Python 2.7" and "Python 3.4"
I can open IDLE and type 8+8 and I get 16 just fine.
Here is the error I am getting in terminal:
host-210-117:~ Mario$ python
ImportError: No module named site
host-210-117:~ Mario$ pip
ImportError: No module named site
My goal is to run this command in the terminal:
pip install requests
I believe pip is already installed. I run the file "get-pip.py" in IDLE and this is what it says:
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg
Cleaning up...
This may have something to do with paths? I would appreciate some guidance/hints/tips, thanks!
Oh and just a little more info that might help solve this question. Here is the first few lines of the program I'm running:
import base64
import hmac
import json
import requests
import time
import urllib
import os
Which gives me this error in IDLE (so I guess it importing those first few packages with no problem?) :
>>>
Traceback (most recent call last):
File "/Users/Mario/Desktop/pyak/pyak.py", line 4, in <module>
import requests
ImportError: No module named requests
>>>
***** System path list:
sys.path
['/Users/Mario/Desktop/pyak', '/Users/Mario/Documents', '/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
*** another update:
host-210-117:~ Mario$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
*** a little more info (is this supposed to happen?)
host-210-117:~ Mario$ which pip
/usr/local/bin/pip
host-210-117:~ Mario$ pip
ImportError: No module named site
*** After changing .bashrc
.bashrc: here's what in the file
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
alias python=/Library/Python/2.7/python
here is the output of running:
pip install requests
host-210-117:~ Mario$ pip install requests
Downloading/unpacking requests
Downloading requests-2.4.1-py2.py3-none-any.whl (458kB): 458kB downloaded
Installing collected packages: requests
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/requests'
Storing debug log for failure in /Users/Mario/Library/Logs/pip.log
I met the same question, and error info is:
ModuleNotFoundError: No module named 'xxx'
and finally solved by
brew install python3
brew link python3
sudo python3 -m pip install xxx
// or `sudo python3 -m pip install -r requirements.txt`
From what I can tell you have three versions of Python on your system.
The one that comes with OSX /Library/Frameworks/Python.framework/Versions/2.7/
Python 2.7 from python.org /Library/Python/2.7/site-packages
Python 3.4 from python.org
pip is installed against the Python 2.7 version you downloaded (the one you see in your Applications folder), unfortunately the default Python for your shell is the one that's bundled with OSX, and there is no pip installed there.
IDLE is also bundled with the Python that you downloaded, which is why it keeps telling you that pip is installed, but it doesn't work from the shell.
Since you are probably using the Python downloaded from python.org as your "primary" Python (after all, its the one with IDLE that you are using), you need to set your shell environment to point to this Python as default.
The easiest way to do that is to add a variable in .bashrc that creates an alias python and points it to the right binary. To do that, add this line to /Users/yourusername/.bashrc - files with . are hidden by default, so you'll have to write the entire file name in the command line to open it. Add the following line:
alias python=/Library/Python/2.7/python
Save the file and then close all terminal windows and open it again. Now type pip and it should work correctly, and then you can proceed to installing requests.
For future reference, try to stick with one version of Python. I personally ignore the bundled version and use the one from brew, but you can stick to the Python downloaded from python.org.
I fixed mine with:
brew reinstall python
It fixed all my broken paths. I think I broke it with a broken brew package that had a wrong python version dependancy or something like that.
site.py is a standard module that is run by python by default. It allows tweaking sys.path and running some code before your code starts running. It should live in the standard library and can hardly be somehow absent. However, you can disable automatic importing of the module by passing -S switch to python.
Anyway, you should somehow inspect why the module can not be imported. Try to examine sys.path list.
You are trying to install the package in '/Library/Python/2.7/site-packages/requests' but it requires root permissions to do so. This should do the trick:
$ sudo pip install requests
I did some reading. The command line,
python3.10 -m pip install pandas
as long as you have the latest version of pip updated, this will install pandas to the specific python that you wanted otherwise it defaults to the latest version installed in my case Anaconda. You can change the python3.10 for your desired version of python to install too.
sudo easy_install pip
sudo pip install requests

Unable to find virtualenv or django after installing with pip

I installed virtualenv using pip and now receive the following error whenever I actually try and use it:
% virtualenv
Traceback (most recent call last):
File "/bin/virtualenv", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2705, in <module>
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 668, in require
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 571, in resolve
pkg_resources.DistributionNotFound: virtualenv==1.11.2
%
Similarly, I installed django with pip, and when I try and import django in python I get: ImportError: No module named django.
I tried to install virtualenv again, this time using easy_install instead of pip. easy_install gave me an error saying that it was having issues with my PYTHONPATH environment variable. Lo and behold, after reading http://www.stereoplex.com/blog/understanding-imports-and-pythonpath, PYTHONPATH is what python uses to find modules, and my PYTHONPATH was unset.
After setting PYTHONPATH to /lib/python3.3/site-packages (where pip was installing my modules), both virtualenv and importing django functioned properly.
Note: because I have both python2.7 and python 3.3 installed, for me pip actually installs packages to /lib/python2.7/site-packages while pip3 installs packages to the aforementioned /lib/python3.3/site-packages.
For the unfamiliar, information on setting environment variables can be found here: https://help.ubuntu.com/community/EnvironmentVariables

Categories