s4cmd icon indicating copy to clipboard operation
s4cmd copied to clipboard

/usr/bin/python: No module named s4cmd

Open centminmod opened this issue 10 years ago • 2 comments

On CentOS 6.7 with python 2.6 system default and python 3.4 side by side via IUS Community repo

locate /usr/bin/pip
/usr/bin/pip
/usr/bin/pip3
/usr/bin/pip3.4

pip --version
pip 7.1.2 from /usr/lib/python3.4/site-packages (python 3.4)

python --version
Python 2.6.6

I installed s4cmd via

pip install s4cmd

but get

s4cmd
/usr/bin/python: No module named s4cmd

best way to correct this ?

centminmod avatar Sep 29 '15 18:09 centminmod

I'm running into a similar problem. Here is how it breaks down for me. at reboot I run a script on my ubuntu ec2 called onboot.sh via a cronjob all the script does is call

python pythonscript.py &> logfile.txt 

(run the python script and save all outputs to the terminal to a log file) pythonscript.py processes some images, then tiles them into a folder. Once the tiling is complete I call:

subprocess.Popen(['s4cmd', 'put', 'localfolderpath', 's3path', '--recursive']).wait()

I've also tried

os.system('bin/bash -c "s4cmd put localfolderpath s3path --recursive"')

That fails with error: /bin/bash: s4cmd: command not found The uploads fail every time when this is called on boot . However when I ssh into my ec2 and run pythonscript.py from the terminal it works just fine.

Any thoughts? Do I need to add something to my path variable?

grossman83 avatar Oct 08 '15 19:10 grossman83

Actually, I have figured out what my problem was. For whatever reason my PATH variable is different when I'm logged in vs when the script is run automatically. To fix my problem, and it may work for yours, I've added this line to the bash script that runs on boot before calling my python code that eventually calls s4cmd put blah blah

PATH=$PATH:/usr/local/bin

because /usr/local/bin is the location of s4cmd on linux by default. This seems to ahve solved my problems.

grossman83 avatar Oct 08 '15 22:10 grossman83