shell script within Conda env can't execute mkdir
shell script within Conda env can't execute mkdir
We are on an Ubuntu system running conda.
Within an environment (python2, pandas, other packages) we are trying to run a shell script that:
1. creates dir (mkdir)
2. runs executables the path to which are in PATH (.bashrc)
Neither of these are working, and I imagine is a config error on our part.
Here are the errors:
mkdir: cannot create directory ‘ResultsSparCC/Resamplings2’: No such file or directory
mkdir: cannot create directory ‘ResultsSparCC/Bootstraps’: No such file or directory
./sparccWrapper.sh: line 31: ResultsSparCC/sparcc.log: No such file or directory
Traceback (most recent call last):
File "/home/charlesh/binf/src/sparcc/MakeBootstraps.py", line 9, in <module>
from analysis_methods import permute_w_replacement
File "/home/binf/src/sparcc/analysis_methods.py", line 7, in <module>
from pandas import DataFrame as DF
ImportError: No module named pandas
However, pandas is installed in the environment:
$conda list|grep pandas
pandas 0.23.1 py27h637b7d7_0
Here is a snippet of the offending code in the script:
#!/bin/bash
////
INPUT_PATH="foo.txt"
OUTPUT_PATH="ResultsSparCC"
///
mkdir $OUTPUT_PATH/Resamplings2
mkdir $OUTPUT_PATH/Bootstraps
Suggestions?
ResultsSparCC
@ResultsSparCC is right, if $OUTPUT_PATH does not exist either, use
mkdir -p
– Nic3500
Jul 1 at 4:58
mkdir -p
1 Answer
1
The main suggestion is: read the error-message.
mkdir: cannot create directory ‘ResultsSparCC/Resamplings2’: No such file or directory
mkdir
complains that there is no directory ResultsSparCC
in which it should create Resamplings2
.
mkdir
ResultsSparCC
Resamplings2
So, if you do ls -l
, do you see the directory ResultsSparCC
? Probably not. What happens if you do `mkdir ResultsSparCC/Resamplings2’ by hand?
ls -l
ResultsSparCC
If you create the directory ResultsSparCC
, all scripts should work.
ResultsSparCC
Alternatively, use mkdir -p
:
mkdir -p
#!/bin/bash
#////
INPUT_PATH="foo.txt"
OUTPUT_PATH="ResultsSparCC"
///
mkdir -p $OUTPUT_PATH/Resamplings2
mkdir -p $OUTPUT_PATH/Bootstraps
Thanks - that fixed problem (silly mistake on my part)
– Charles Hauser
Jul 1 at 12:41
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Are you expecting your script to create the directory
ResultsSparCC
?– that other guy
Jul 1 at 0:56