Package 'python3-venv' has no installation candidate - python

I'm currently trying to install Flask for testing a simple web page.
Unfortunately i got the following message:
Command 'virtualenv' not found, but can be installed with:
sudo apt install python3-virtualenv
When i do it, i got :
Unable to locate package python3-virtualenv
I check my python version and I'm on Python 3.10.4
Whent i try sudo apt-get update i got:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Whent i try sudo apt-get upgrade i got:
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
And when i try sudo apt-get install python3-venv i got :
E: Package 'python3-venv' has no installation candidate

sudo apt install python3-virtualenv works perfectly fine with me.
Alternatively you can install it using pip
pip3 install virtualenv
After completion you can check for which virtualenv to get the path of the location where it has been installed.
It seems there is an error with your ubuntu, You can use this site and fix it and then install the virtual environment : https://www.tecmint.com/some-index-files-failed-to-download.

Had this problem after upgrading to Ubuntu 20.4 and all my problems stemmed from a very old version of Pip that was solved by this lovely command:
curl -sS https://bootstrap.pypa.io/get-pip.py | python3
More information and some alternatives here: pip3 install not working - No module named 'pip._vendor.pkg_resources'

Related

Why do I get an error "[Errno 42] Illegal byte sequence" when trying to install pillow using pip?

I want to install pillow, but when I run pip install pillow in the cmd I get the following message:
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
Collecting pillow
Downloading https://files.pythonhosted.org/packages/5e/b6/8960697526a79bd1cb4520293078be3a10d725f23f20abbee298ebdeaabd/Pillow-6.2.2-cp27-cp27m-win_amd64.whl (1.9MB)
|ERROR: Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
WARNING: You are using pip version 19.2.3, however version 20.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Python 3.8.2 is already installed on my computer and I added it to PATH.
I also ran python -m pip install --upgrade pip and nothing has changed.
What is the problem? Do I need to update the Python version?
Installation using third party PPA repository
Step 1: First install the Ubuntu software properties package if it’s not already installed on your system.
$ sudo apt update
$ sudo apt install software-properties-common
Step 2: After that run the commands to add the PPA.
$ sudo add-apt-repository ppa:deadsnakes/ppa
Step 3: Finally, run below to install Python 3.8
$ sudo apt update
$ sudo apt install python3.8
You can check as below:
$ python3 --version
Python 3.8.1
OK done.
Don't use the pip, pip3, etc. scripts ever. Instead always prefer the more explicit and surefire way of calling pip's executable module for a specific instance of the Python interpreter, for example:
path/to/pythonX.Y -m pip install Pillow
References:
https://snarky.ca/why-you-should-use-python-m-pip/
https://snarky.ca/a-quick-and-dirty-guide-on-how-to-install-packages-for-python/
Check if Python3 is correctly installed by, for example, running python3 -V in the command-line (this will show you the installed version)
This should show something like Python 3.8 ...
If you get an error here, like it is an unknown command, something probably went wrong during the installation...
Run pip3 install pillow to install pillow (Python 3)
Kindly download it at Python official website.
There is an option to update your version during the installation which is very useful.

"google-oauthlib-tool: command not found" when trying to install google assistant on raspbian

I'm trying to install google assistant on a newly set up pi 3 with Raspbian. I got the message "No module named googlesamples.assistant.auth_helpers" so I followed the instructions given in answer to this question: No module named googlesamples.assistant.auth_helpers
The first 2 commands appear to complete OK, but the third command gives
"google-oauthlib-tool: command not found"
My programming skills are too rusty to work out what's going wrong.
Python 3.5.3; forgotten how to find the version of SDK, but should be the latest one.
Any help greatly appreciated.
Have you followed the instructions to set up a virtual Python environment?
sudo apt-get update
sudo apt-get install python3-dev python3-venv
# Use python3.4-venv if the package cannot be found.
python3 -m venv env
env/bin/python -m pip install --upgrade pip setuptools
source env/bin/activate
Then you should be able to install the oauth tool with pip:
python -m pip install --upgrade google-auth-oauthlib[tool]
You can display all of your installed packages using pip freeze
pip freeze | grep google
Before running python -m pip install --upgrade google-auth-oauthlib[tool] , run
pip install google-auth
And then:
python -m pip install --upgrade google-auth-oauthlib[tool]
google-auth is a dependency of google-auth-oauthlib in Raspbian
You need to locate the tool via locate google-oauthlib-tool
Then, cd into the path and open it there with your arguments

Error while installing python-pip

I'm trying to install Superset (Airbnb Data visualizer) on an equivalent of "PuTTY" installed by the firm I'm working for on a Windows computer, following this tutorial : http://airbnb.io/superset/installation.html
After the first lines (sudo yum install ...) I tried this line :
pip install virtualenv
And I had:
"bash: pip: command not found".
I tried the following :
sudo easy_install pip
sudo yum install python-pip
yum install -y python-pip # after a yum -y update
It still doesn't work... I have errors everytime, particularly this one :
Loaded plugins: rhnplugin, search-disabled-repos This system is
receiving updates from RHN Classic or Red Hat Satellite. No package
python-pip available. Error: Nothing to do
Then I found solutions on the web, I tried this :
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
But I have an error again (Name or service not known).
I absolutely do not know what to do. Do you have an idea to solve this problem ?
Thank you for your help.
Edit : I found more détails : I use a RedHat Linux 7.2-11
I would try and install pip using the first option from the Pip page.
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

ImportError: No module named psycopg2

In installation process of OpenERP 6, I want to generate a config file with these commands:
cd /home/openerp/openerp-server/bin/
./openerp-server.py -s --stop-after-init -c /home/openerp/openerp-server.cfg
But it always showed the message: ImportError: No module named psycopg2
When I checked for psycopg2 package, it's already installed. Package python-psycopg2-2.4.5-1.rhel5.x86_64 is already installed to its latest version. Nothing to do. What's wrong with this? My server is CentOS, I've installed Python 2.6.7.
Step 1: Install the dependencies
sudo apt-get install build-dep python-psycopg2
Step 2: Run this command in your virtualenv
pip install psycopg2-binary
Ref: Fernando Munoz
Use psycopg2-binary instead of psycopg2.
pip install psycopg2-binary
Or you will get the warning below:
UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.
Reference: Psycopg 2.7.4 released | Psycopg
I faced the same issue and resolved it with following commands:
sudo apt-get install libpq-dev
pip install psycopg2
Try installing
psycopg2-binary
with
pip install psycopg2-binary --user
Please try to run the command import psycopg2 on the python console. If you get the error then check the sys.path where the python look for the install module. If the parent directory of the python-psycopg2-2.4.5-1.rhel5.x86_64 is there in the sys.path or not. If its not in the sys.path then run export PYTHONPATH=<parent directory of python-psycopg2-2.4.5-1.rhel5.x86_64> before running the openerp server.
Import Error on Mac OS
If psycopg2 is getting installed but you are unable to import it in your .py file then the problem is libpq, its linkages, and the library openssl, on which libpq depends upon. The overall steps are reproduced below. You can check it step by step to know which is the source of error for you and then you can troubleshoot from there.
Check for the installation of the openssl and make sure it's working.
Check for installation of libpq in your system it may not have been installed or not linked. If not installed then install it using the command brew install libpq. This installs libpq library. As per the documentation
libpq is the C application programmer's interface to PostgreSQL. libpq is a set of library functions that allow client programs to pass queries to the PostgreSQL backend server and to receive the results of these queries.
Link libpq using brew link libpq, if this doesn't work then use the command: brew link libpq --force.
Also put in your .zshrc file the following export PATH="/usr/local/opt/libpq/bin:$PATH". This creates all the necessary linkages for libpq library .
Now restart the terminal or use the following command source ~/.zshrc.
Now use the command pip install psycopg2. It will work.
This works, even when you are working in conda environment.
N.B. pip install psycopg2-binaryshould be avoided because as per the developers of the psycopg2 library
The use of the -binary packages in production is discouraged because in the past they proved unreliable in multithread environments. This might have been fixed in more recent versions but I have never managed to reproduce the failure.
Try with these:
virtualenv -p /usr/bin/python3 test_env
source test_env/bin/activate
pip install psycopg2
run python and try to import if you insist on installing it on your systems python try:
pip3 install psycopg2
Recently faced this issue on my production server. I had installed pyscopg2 using
sudo pip install psycopg2
It worked beautifully on my local, but had me for a run on my ec2 server.
sudo python -m pip install psycopg2
The above command worked for me there. Posting here just in case it would help someone in future.
sudo pip install psycopg2-binary
You need to install the psycopg2 module.
On CentOS:
Make sure Python 2.7+ is installed. If not, follow these instructions: http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/
# Python 2.7.6:
$ wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
$ tar xf Python-2.7.6.tar.xz
$ cd Python-2.7.6
$ ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
$ make && make altinstall
$ yum install postgresql-libs
# First get the setup script for Setuptools:
$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
# Then install it for Python 2.7 and/or Python 3.3:
$ python2.7 ez_setup.py
$ easy_install-2.7 psycopg2
Even though this is a CentOS question, here are the instructions for Ubuntu:
$ sudo apt-get install python3-pip python-distribute python-dev
$ easy_install psycopg2
Cite: http://initd.org/psycopg/install/
For python3 on ubuntu, this worked for me:
$sudo apt-get update
$sudo apt-get install libpq-dev
$sudo pip3 install psycopg2-binary
i have the same problem, but this piece of snippet alone solved my problem.
pip install psycopg2
Run into the same issue when I switch to Ubuntu from Windows 10.. the following worked for me.. this after googling and trying numerous suggestions for 2 hours...
sudo apt-get install libpq-dev
then
pip3 install psycopg2
I hope this helps someone who has encountered the same problem especially when switching for windows OS to Linux(Ubuntu).
I have done 2 things to solve this issue:
use Python 3.6 instead of 3.8.
change Django version to 2.2 (may be working with some higher but I change to 2.2)
For Python3
Step 1: Install Dependencies
sudo apt-get install python3 python-dev python3-dev
Step 2: Install
pip install psycopg2
check correctly if you had ON your virtual env of your peoject, if it's OFF then make it ON. execute following cammands:
workon <your_env_name>
python manage.py runserver
It's working for me
It's very simple, not sure why nobody mentioned this for mac before.
brew install postgresql
pip3 install psycopg2
In simple terms, psycopg2 wants us to install postgres first.
PS: Don't forget to upvote, so that it can help other people as well.
Solved the issue with below solution :
Basically the issue due to _bz2.cpython-36m-x86_64-linux-gnu.so Linux package file. Try to find the the location.
Check the install python location ( which python3)- Example: /usr/local/bin/python3
copy the file under INSTALL_LOCATION/lib/python3.6
cp -rvp /usr/lib64/python3.6/lib-dynload/_bz2.cpython-36m-x86_64-linux-gnu.so /usr/local/lib/python3.6
try:
pip install psycopg2 --force-reinstall --no-cache-dir
Python2 importerror no module named psycopg2
pip install psycopg2-binary
Requirement already satisfied...
Solved by following steps:
sudo curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
sudo python get-pip.py
sudo python -m pip install psycopg2-binary
pip install psycopg-binary
The line above helped me
For Python3 use this:
sudo apt-get install -y python3-psycopg2

Installing Python Package from Github Using PIP

I've seen it documented that you can install a Github hosting Python package using pip via:
sudo pip install -e git+git://github.com/myuser/myproject.git#egg=myproject
However, this appears to install the package to the current working directory, which is almost never where is should be.
How do you instruct pip to install it into the standard Python package directory (e.g. on Ubuntu this is /usr/local/lib/python2.6/dist-packages)?
The -e flag tells pip to install it as "editable", i.e. keep the source around. Drop the -e flag and it should do about what you expect.
sudo pip install git+git://github.com/myuser/myproject.git#egg=myproject
If that doesn't work try using https instead of git.
sudo pip install git+https://github.com/myuser/myproject.git#egg=myproject
For Python 3 make sure you have python3-pip installed (and of course git installed):
The syntax just changed to:
sudo pip3 install git+git://github.com/someuser/someproject.git

Categories

Resources