Reputation: 285
My resources:
Python 2.7, Ubunutu 18.04, Pycharm, virtual box oracle
I have an automation solution built in python.
The solution can be run from both cmd
or pycharm
of course.
2 options to run automation solution.
python main.py args a,b,c...(run 1 suite of tests)
python jenkinsRun.py arg a,b,c...(run main.py with diff args each time -lets say 5 time for instance)
Once jenkinsRun.py
is runnig it will execute each main.py
like this:
os.system('python main.py %s %s %s %s %s %s'%(STD,config.VpcStackName, '-dryrun', 'false', '-tenant' ,config.PROD_STAGE_Tenant))
Note that this is how I implemented it 3 years ago..could be better ways like using __import__
, but need way to pass arguments, etc...
Anyway, when run:
python main.py arg a,b,c..
All good.
When run:
jenkinsRun.py
which should run main each time with diff args I get exception:
"/home/ohad/.local/lib/python2.7/site-packages/botocore/httpsession.py", line 7, in <module>
from urllib3.util.ssl_ import (
ImportError: cannot import name ssl
This happend only when I run the code on my new environment (see resources above) last week I had old virtul box with ubuntu 15.04 (old) which everything worked well (didn't touch the vode ever since).
I have installed on new virtual box from scratch libaries, drivers, etc, etc.
Any ideas?
Upvotes: 18
Views: 79337
Reputation: 1583
In my case this issue came apparently from having colliding versions of boto3
, botocore
and awscli
. This fixed the issue:
pip install boto3 botocore awscli aiobotocore --ignore-installed
As noted in the comments this can be really slow so I recommend to search for the compatible versions and tell pip to install them, for example:
pip install boto3==1.33.13 botocore==1.33.13 awscli==1.31.13 aiobotocore==2.9.0 --ignore-installed
Upvotes: 2
Reputation: 329
Im able to slove the error with below change
From anaconda3\Library\bin copy below files and paste them in anaconda3/DLLs
Upvotes: 0
Reputation: 119
If you are using boto3 as a dependency, there was a bug with how the boto3 dependencies were managed.
try running
pip3 install boto3 --upgrade
to update boto3 and the issue should be resolved!
Upvotes: 8
Reputation: 13
I was getting the same error on Win 10 and VS Code was pointing at the Conda interpreter. The issue was solved by installing Python 3.11 outside of Conda and pointing at the new interpreter. Don't forget to add the new Python to PATH and install boto3 afterwards.
Upvotes: 0
Reputation: 526
I am not sure why it worked. But, I had this issue in AWS Glue, and I was able to get around this problem by using Glue 3.0 instead of Glue 2.0.
Upvotes: -2
Reputation: 1
After uninstalling, installing, even creating environments... this worked for me!
https://stackoverflow.com/a/60405693
Upvotes: 0
Reputation: 10994
Update the latest version of awscli
resolved on my Mac by the below command line.
curl "https://awscli.amazonaws.com/AWSCLIV2-2.0.30.pkg" -o
"AWSCLIV2.pkg" sudo installer -pkg AWSCLIV2.pkg -target /
Reference:
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html#cliv2-mac-install-cmd
Upvotes: 0
Reputation: 14988
I was working in PyCharm when I hit this wall.
Solved it by redirecting the path to my Anaconda environment, which I keep better provisioned and up to date.
Upvotes: 0
Reputation: 190
Could be some issue with installation. I did re-installed on MAC and it worked
sudo pip install awscli --ignore-installed six
Upvotes: 19
Reputation: 6752
I had a similar error after creating a new environment (which also uses Boto3). It turned out to be a DLL error (ImportError: DLL load failed
), which was caught by SSL module resulting in the error from the question: ImportError: cannot import name ssl
.
Solution for me was to add an additional folder to the path: path_to_anaconda/Anaconda3/Library/bin
. In that way, DLL load succeeds and the given ImportError is resolved.
Upvotes: 3
Reputation: 16515
Just to make sure: are you certain that you are invoking Python 2.x
?
Ubuntu 18.04
has Python 3.x
as default, so make sure that you are not accidentally starting the script using another python version.
Upvotes: 3