Issue
need some help to connect my python code, which runs in a virtual environment (AWS ec2) with S3 on AWS.
i already connect the instance via IAM - that works. it is also possible to run the code in my pycharm environment. but if i run the code on my ec2 the error is: NO module name boto3! But i install the module with requirements.text. i run the code i a shell
awscli==1.18.222
fsspec==0.8.5
s3fs==0.5.2
boto3==1.16.51
boto3-stubs==1.16.59.0
botocore==1.17.44
s3ts==0.1.0
think that's more than necessary.
#!/bin/sh
cd ~/code/namexy
git pull
pip3 install virtualenv
virtualenv -p python3 venv
(
source venv/bin/activate
pip3 install -r requirements.txt
python main.py
)
git add *
git commit -m "AWS ec2: data_main"
git push origin main
Solution
ok the problem "may" was, that installed a package which removed boto3 package (botocore). now my code looks like this and runs!
#!/bin/sh
cd ~/code/namexy
git pull
rm -rf venv
mkdir venv
pip3 install --user virtualenv
virtualenv -p /usr/bin/python3 venv/python3
source venv/python3/bin/activate
pip3 install -r requirements.txt
pip3 freeze
python3 main.py
deactivate
git add *
git commit -m "AWS ec2: "main"
git push origin main
Answered By - Alex