Install venv for python3 - python

I'm trying to create venv using python3 on Ubuntu 15.10.
I have installed python 3.4.4.
First, I tried to install venv via pip3 (I already installed it via python2.7 but as far as I understand, for py3 I should install it again)
pip3 install virtualenv
And I got The 'pip==8.0.0' distribution was not found and is required by the application error.
Next I tried to install pip3 with this command:
> sudo apt-get install python3-pip
and looks like it was successfully completed. But when I run
> pip3
I get following error:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3130, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3116, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3143, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 644, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 657, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 830, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==8.0.0' distribution was not found and is required by the application
If I run
> pip --version
pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)
Am I doing something wrong? Does pip3 require only pip==8.0?

Your pip is pointing to python 2.7
usr/local/lib/python2.7/
first change path
export PATH=/path/to/python3:/path/to/python3/scripts-folder:/path/to/python3-pip:$PATH
check path
echo $PATH
then run pip or pip3

Related

Can't install PyQt5 using pip

I have tried to install PyQt5 using
pip install PyQt5
and
sudo -H pip install PyQt5
both of them give me the errors
ERROR: Could not find a version that satisfies the requirement PyQt5 (from versions: none)
ERROR: No matching distribution found for PyQt5
I use Ubuntu 18.04.
My python version is: Python 2.7.15rc1
I have already installed python3-pip and tried to install PyQt5 using
pip3 install PyQt5
I get the error
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3241, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.1' distribution was not found and is required by the application
My python3 version is: Python3.6.7.
You need to upgrade your pip
pip install --user --upgrade pip
Then do a fresh install
pip install PyQt5
or
pip3 install PyQt5
Try this:
python3 -m pip install PyQt5
I know it is a bit late to answer.
In PyCharm, even upgraded pip gives error in this package.
Downgraded the PyQt5 version to 5.12.2 works fine.
Use,
pip install PyQt5==5.12.2
pip install PyQtWebEngine==5.12
Or,
pip3 install PyQt5==5.12.2
pip3 install PyQtWebEngine==5.12
Works fine for me.
You can run command
pip3 install PyQt5
or for Python 2 you can manually install from https://www.riverbankcomputing.com/software/pyqt/download5

pkg_resources.DistributionNotFound: The 'pipenv==2018.10.13' distribution was not found and is required by the application

I've reinstalled pip and pipenv due to some broken package with ansible. Now, it seems like my pip dependencies are all screwed. Any suggestion or help is greatly appreciated.
$ which python2
/usr/local/bin/python2
$ which python3
/usr/local/bin/python3
$ which pipenv
/usr/local/bin/pipenv
Traceback (most recent call last):
File "/usr/local/Cellar/pipenv/2018.10.13/libexec/bin/pipenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3123, in <module>
#_call_aside
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3107, in _call_aside
f(*args, **kwargs)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3136, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 580, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 593, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 781, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pipenv==2018.10.13' distribution was not found and is required by the application
I had the same problem. You should reinstall pipenv using the same package manager you used the first time.
If the installation was done using pip, then:
pip uninstall pipenv
pip install pipenv
If you are using brew, then you must run the commands exposed by Andrei
brew uninstall pipenv
brew install pipenv
To check if pipenv installation was successfully completed, run:
pipenv --version
From the comments, alternatively use:
brew reinstall pipenv
This should fix the problem too:
pipenv --rm
pipenv check
pipenv sync
I run into this problem from time to time when updating python using anaconda.
if you get this kind of "pkg_resources.DistributionNotFound: The 'filelock<4,>=3.4.1' distribution was not found and is required by virtualenv" error you can also solve it by
navigating to the folder and then run "pip install pipenv"
first go to the virtual env directory by typing below command on the terminal
cd ~/.local/share/virtualenvs/
then check for a directory having project name as prefix, and open terminal inside that directory and type
mkdir bin; cp local/bin/python bin/
after this go the the your project directory and run pipenv install again.

Pip version virtualenv doesn't match and won't upgrade

Okay, so, I run my project packages in a virtual environment. I usually manage these packages through PyCharm. PyCharm tells me I have Pip 9.0.1 installed. Only when I run my virtual environment from the command line and I print pip version, it says 7.1.0. If I try upgrading using pip install --upgrade pip I get an error
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 7.1.0
Uninstalling pip-7.1.0:
Successfully uninstalled pip-7.1.0
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\basecommand.py", line 223, in main
status = self.run(options, args)
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\commands\install.py", line 299, in run
root=options.root_path,
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\req\req_set.py", line 646, in install
**kwargs
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\req\req_install.py", line 813, in install
self.move_wheel_files(self.source_dir, root=root)
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\req\req_install.py", line 1008, in move_wheel_files
isolated=self.isolated,
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\wheel.py", line 449, in move_wheel_files
generated.extend(maker.make(spec))
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\_vendor\distlib\scripts.py", line 323, in make
self._make_script(entry, filenames, options=options)
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\_vendor\distlib\scripts.py", line 227, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\_vendor\distlib\scripts.py", line 163, in _write_script
launcher = self._get_launcher('t')
File "c:\python-virtualenv\arcus\lib\site-packages\pip-7.1.0-py3.5.egg\pip\_vendor\distlib\scripts.py", line 302, in _get_launcher
result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
My system-wide pip version is 9.0.1 though. I just don't get what is happening. Hopefully someone can shed some light. I've tried de-installing and re-installing it again, I've tried using a wheel to install, doesn't work
Windows, by the way.
I had the same issue, but found the answer here:
https://github.com/pypa/pip/issues/2669
Basicly I just had to use this command instead:
easy_install -U pip
Open the Command Prompt (cmd) as administrator and run:
pip install --user --upgrade pip
Or try:
python -m pip install --user --upgrade pip
Relevant GitHub issue.

pip upgrade OSError: [Errno:13] Permission Denied

I need to upgrade pip on my Ubuntu system but I am getting error:
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
**kwargs
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber
ensure_dir(destdir)
File "/home/shivams334/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-9.0.1.dist-info'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Maybe I should go with 'chown' but don't know how to use it. Please help.
Since you want to upgrade your system-wide Python, you need to run this command with administrator privilege:
sudo pip install -U pip
But, I recommend you not changing/polluting your system-wide Python. Instead use a virtualenv:
virtualenv myapp
source myapp/bin/activate
pip install -U pip # <- only if virtualenv is not up to date

Error: "No module named _markerlib" when installing some packages on virtualenv

I can't install some packages on virtualenv because of this error.
I tried to install:
pip install pyups==0.4.4
and
pip install --upgrade distribute
and they give me the error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-tLx1oC/distribute/setup.py", line 58, in <module>
setuptools.setup(**setup_params)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setuptools/command/egg_info.py", line 177, in run
writer = ep.load(installer=installer)
File "pkg_resources.py", line 2241, in load
if require: self.require(env, installer)
File "pkg_resources.py", line 2254, in require
working_set.resolve(self.dist.requires(self.extras),env,installer)))
File "pkg_resources.py", line 2471, in requires
dm = self._dep_map
File "pkg_resources.py", line 2682, in _dep_map
self.__dep_map = self._compute_dependencies()
File "pkg_resources.py", line 2699, in _compute_dependencies
from _markerlib import compile as compile_marker
ImportError: No module named _markerlib
I tried also to install markerlib with
pip install markerlib
But the error continues.
$ easy_install distribute
or build from source works for me
I try the following command
easy_install distribute
pip install --upgrade distribute
which works.
install setuptools:
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-19.2.zip
unzip setuptools-19.2.zip
cd setuptools-19.2
python setup.py install
Although the virtualenv docs says --distribute and --setuptools options are now legacy, when I created the environment with :
virtualenv myenv --distribute
the error was gone.
This sound silly. But It works for me. I am using ubuntu. While Installing virtualenv through apt-get install I faced problems. But I got working with pip install virtualenv.
sudo pip uninstall virtualenv
sudo apt-get purge python-virtualenv
sudo pip install virtualenv

Categories

Resources