Issue in installing AWS EB CLI - python

I'm following this instruction to install eb cli, but it raise this error:
Will not install to the user site because it will lack sys.path precedence to python-dateutil in c:\virtual envs\python_XXXX\lib\site-packages
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-windows.html
I basically run this pip command:
pip install awsebcli --upgrade --user
On Python 3.8 in a virtual env

If you are installing within a virtual environment, run the same command, but without --user. Refer to this issue here https://github.com/pypa/pip/issues/573

Related

I used pip3 to install virtualenv but I can't create venv and also I can't uninstall virtualenv

I'm using Linux Mint 20.2 with two directories / and /home.
I used the following command to install virtualenv:
>>> sudo pip3 install virtualenv
It worked fine and it installed in the following path:
>>> virtualenv --version
virtualenv 20.0.17 from /usr/lib/python3/dist-packages/virtualenv/__init__.py
But when I tried to create an environment I got the following error:
>>> python3 -m venv article
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.8-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/username/article_tools/article/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
When I tried to uninstall it to install it using [b]sudo apt install python3.8-venv[/b], I got the following error:
>>> sudo pip3 uninstall virtualenv
Found existing installation: virtualenv 20.0.17
Not uninstalling virtualenv at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'virtualenv'. No files were found to uninstall.
How can I fix it? By fix, I mean installing virtualenv in a way that I don't get such errors.
The fundamental problem here seems to be that you are mixing up two different packages.
Python 3 comes with a built-in virtual environment module venv which is however not installed by default on Debian-based platforms. Like the error message says, apt-get install -y python3-venv will install this package, which you can then use with python3 -m venv.
virtualenv is a separate third-party package which you invoke with the command virtualenv. It's not a bad alternative, but if you are only just learning, I would suggest you simply ignore it for the time being.

AWS EC2 Python ModuleNotFoundError

I am using an EC2 instance with Deep Learning AMI based on Ubuntu 18.04.
I am doing the following:
Start the terminal
Activate the conda environment: conda activate tensorflow2_latest_p37
Install the package pip3 install tensorrt
Run my code python3 mycode.py
And I get the following error:
ModuleNotFoundError: No module named 'tensorrt'
I also trying to install as sudo or with -U or -m option. Nothing work. I can't install with conda install because tensorrt is not available in it.
pip3 will use ubuntu's level pip3, not from anaconda. You can confirm this by using which pip3 after you activate your environemnt. ALso tensorrt is not available for python other then 3.6
So to install tensorrt on Ubuntu 18.04 Deep Learnig:
conda activate tensorflow2_p36
# then in tensorflow2_p36 environment
pip install nvidia-pyindex
pip install --upgrade nvidia-tensorrt

Upgrading Pip in Venv Overrides Python Installation

I made the mistake of using the --user option when upgrading pip inside of venv, and now the output of which python is /usr/bin/python when before it was /Users/myName/myVenv/bin/python. Now I can't just run python to get my desired installation. Why is this, and how can I fix it?.
The command in question:
pip install --user --upgrade pip
Running:
pip freeze
Outputs WARNING: pip is being invoked by an old script wrapper. This seems to be because while I setup my venv with Python3, the reversion set the default back to Python2, which is the default installation on MacOS Catalina.

pip freeze gives different version from pip --version

I am on Windows 10 and just installed Python 3.7.4. I installed virtualenv using pip install virtualenv, and i got the message that i installed 16.7.2 while 19.2.1 is available. I then used python -m pip install --upgrade pip to upgrade.
Here is the issue: when i type pip freeze on Powershell, i am getting this:
virtualenv==16.7.2
but when i type pip --version, i am getting this:
pip 19.2.1 from c:\users\user1\python\lib\site-packages\pip (python 3.7)
Can you please let me know why pip freeze still shows the old version?
Thanks.
pip and virtualenv are 2 different cases where pip is mainly used for installing python packages and virtualenv for utilizing virtual environments while development.
The following command updates only pip not virtual env
python -m pip install --upgrade pip
If you think you still need to upgrade virtualenv (of course if a new version is available). Please follow the following syntax without specifying a version.
pip install [package] --upgrade

Flask python framework installation

I have been trying to install and run it but it's not working.
I am suppose to create a virtual environment first in my working folder I was able to install virtualenv in python-scripts folder. I am using cmd line in Windows.
C:\Users\ADMIN\python\Scripts>pip install virtualenv
Requirement already satisfied: virtualenv in c:\users\admin\python\lib\site-packages (16.0.0)
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\ADMIN\python\Scripts>cd..
C:\Users\ADMIN\python>cd..
C:\Users\ADMIN>cd desktop
C:\Users\ADMIN\Desktop>cd flask_bookreview
C:\Users\ADMIN\Desktop\flask_bookreview>virtualenv flask
'virtualenv' is not recognized as an internal or external command,
operable program or batch file.
Read this link to install and activate your virtual enviroment:
http://pymote.readthedocs.io/en/latest/install/windows_virtualenv.html
when you successfully install and activate your virtual environment then run this command to install flask:-
pip install flask
try the answer of Manish Mahendru if you want to install it manually, but if you just want it too work, take a look at Anaconda (www.anaconda.com/download/).
It contains a ton of useful packages and every one I've used (till now) is already installed with it. flask is installed too.
For creating virtual environment you have to do,
python -m venv flaskenv
Now activate the virtualenv like
cd flaskenv
Scripts\activate.bat
Now install as
(flaskenv) C:/User/ADMIN/> pip install flask

Categories

Resources