ModuleNotFoundError: No module named 'awscli' after Mac os update - amazon-web-services

awscli does not work after Mac os update.
while running a bash script got following error:
File "/usr/local/bin/aws", line 19, in <module>
import awscli.clidriver
ModuleNotFoundError: No module named 'awscli'
Tried:
pip3 install awscli --upgrade --user
While installing awscli got following warning and error:
WARNING: Ignoring invalid distribution -oto3 (/Users/myaccount/.pyenv/versions/3.6.9/lib/python3.6/site-packages)
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
boto3 1.10.16 requires botocore<1.14.0,>=1.13.16, but you have botocore 1.24.15 which is incompatible.
boto3 1.10.16 requires s3transfer<0.3.0,>=0.2.0, but you have s3transfer 0.5.2 which is incompatible.
aiobotocore 1.3.3 requires botocore<1.20.107,>=1.20.106, but you have botocore 1.24.15 which is incompatible.
uninstall botocore and reinstall it, still get above warning and error.
Take a look of pip3
which pip3
/Users/myaccount/.pyenv/shims/pip3
What might cause this problem?

Personally, I'd consider using brew to install the awscli, not pip. You (probably) only want one awscli installed, but you potentially have multiple installations of Python, including the stock Mac OS-provided Python.
The awscli now comes with its own binaries so doesn't need an external Python installation anyway.
If you need boto3 or, less frequently, botocore then install those using your pip of choice.

Related

AWS Boto3 Compatibility Issue, How can I install an older version of Boto3?

I'm trying to deploy my Django project to AWS Elastic Beanstalk.
The tutorial I am following is suggesting I use Boto3 to link up my S3 Database.
The problem is when I am installing Boto3 i am getting this message in red.
awsebcli 3.20.3 requires botocore<1.24.0,>1.23.41, but you have botocore 1.27.7 which is incompatible.
So I'm trying to install the older version of Botocore, 1.24.0 or 1.23.41, but after looking at PyPi I can't seem to find it since it just says use pip3 install boto3.
Any suggestions?
Try the following:
pip install boto3==1.21.21
pip install botocore==1.24.21
I had the same problem:
If you already installed boto3 then do these:
pip uninstall boto3
pip uninstall botocore
pip uninstall s3transfer
then do these:
pip install botocore==1.23.54
pip install boto3==1.20.54
Hope this helps!
The best way to fix this is to use python virtual environments.
The AWS EB CLI is pegged to a very specific version of botocore and they don't update it very often. As a result, you don't want it to be in the mix for your project dependencies because it will make it hard for you to install other libraries (like modern versions of boto3).
A general setup that you can use is the following:
Install awsebcli globally (you only need it for its scripts)
Make a virtual environment for your project
Install all of your project dependencies in the virtual env; do not install awsebcli in the virtual env
If this doesn't work (such as you have other things you need to install globally with conflicting subdependenceis), you should install awsebcli in its own virtual env and have aliases to activate it, but that gets really messy.

Jinja2 incompatible

I'm trying to install dbt into GCP cloud shell, but always receive this message error:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
flask 2.1.1 requires Jinja2>=3.0, but you have jinja2 2.11.3 which is incompatible.
I resetting cloud shell and remove Jinja using sudo pip3 uninstall Jinja2, after install dbt pip3 install dbt-bigquery. But it shows the same message.

Can't find any modules in Django project

I've been following a Django tutorial and initially created virtualenv and a requirements file in it. Project was halfway and in working state. Today I activated virtualenv successfully and tried python manage.py runserver to get error
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
I realized it's not finding Django and just to be sure checked my requirements.txt file (which confirmed right Django version). Tried to reinstall it from the file using pip3 install -r requirements.txt (tried using just pip too) to get another error --
ModuleNotFoundError: No module named 'pip'
It seems the environment is unable to find any of the modules. I tried to reinstall pip also just to be sure, but then it couldn't find apt-get command.
OS: Mac OSX El Capitan 10.11.6
Python: 3.6.2
Django: 1.10.3 (in requirements file)
Try running python -m ensurepip (or python3 -m ensurepip) to see if pip is already installed:
In most cases, end users of Python shouldn’t need to invoke this module directly (as pip should be bootstrapped by default), but it may be needed if installing pip was skipped when installing Python (or when creating a virtual environment) or after explicitly uninstalling pip.

How to import psycopg2 when installed - Windows

Can somebody please help me install this psycopg2 which I dont even know what it is. I have no python knowledge, I need this to run a code to connect to read data from txt to postgres.
Problem is, I have installed psycopg2 from exe and but when I run import psycopg2 in python shell I get an error:
import psycopg2
Traceback (most recent call last): File "", line 1, in
import psycopg2 ImportError: No module named psycopg2
i think Psycopg2 is not installed.
please install psycopg2 using pip
like:
pip install psycopg2
once done with this you can import
the pip install in windows doesn't seem to work well and ends up with the error you have mentioned. You can try the binaries provided in StickPeople website. These binaries install without problem and will allow you to access psycopg2. Please check the version of python you have installed with the version of the psycopg2 version. If they don't match up, it'll result in such errors. Even the architecture x86 or x64 matters.
C:\> easy_install psycopg2-2.6.1.win32-py2.7-pg9.4.4-release.exe, you can try this if the binary fails.

Scipy package not installing using pip

I am not able to install scipy on my machine with python 2.7
pip install scipy
It always comes up with the following error
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
Just as the message says, You need functioning blas/lapack, which you need to install separately. How to do that depends on the operating system you're on.