exec: does not exist (No such file or directory) - docker

I'm using WSL with docker (with a complex pandoc configuration with latex, python and pandoc-filters) and trying a long command with --filter=filters/the_filter.sh that results in an error:
Error running filter filters/the_filter.sh: ./filters/the_filter.sh: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
My filter is a .sh wrapper, mostly to make sure I'm using Python3 (which may not be needed, but I got the hint from here):
#!/bin/sh
python3 filters/the_filter.py $#
Googling the error shows lots of GitHub issues, but no definitive explanation on Stack overflow.

It turns out that my .sh file had Windows line endings: \r\n.
I assume that the system was trying to find /bin/sh\r but the error message is not explaining it.
Correcting the line-endings using dos2unix filters/the_filter.sh, I was able to get rid of the error.
Here are more details of a related problem.

Related

Airflow on windows 10 - Module not found errors

I'm new to data science and wanted to do a little tutorial, which requires airflow, among other things. I installed it on windows using git bash in VS Code. I tried running it but it had a problem not being able to load the sqlite3 import
command (module not found error). I figured out that if I added the directory of sqlite3.py to the path, it would run, but now it gives me a similar error: pwd module not found from daemon.py
File "C:\ProgramData\Anaconda3\lib\site-packages\daemon\daemon.py", line 18, in <module>
import pwd
ModuleNotFoundError: No module named 'pwd'
Strange to me that it can't find pwd. Obviously pwd works in both git bash and powershell natively. It seems like a basic universal command. I'd love to learn more about what's going on. I don't want to have to end up adding 100 things to path just to get this program to run. I'd love any insights anyone can provide.
PS I'm using Anaconda.
it's seems to be the side effects of Spawning new Python Daemons .
You likely can fix this by downgrading the Python-Daemon :
pip install python-daemon==2.1.2

wont run example_scenes.py in Manim

I used thisvideo as a tutorial
this is a similar problem with no solid solution
particular error code: (ImportError: DLL load failed: The specified module could not be found.)
not sure what to refer to if the only problem is that the file cant be found. if that's what this means.
screenshot of my command prompt
Run This Command in the Command Prompt
pip install numpy

ab: Could not read POST data file: End of file found

I am getting the error in the title when trying to run Apache Bench to test a HTTP endpoint I wrote, but only when specifying a POST file with contents. If I specify an empty file to -p.
I have been trying various solutions found online regarding the encoding and format of the contents, but it seems like just about any content will get this error.
The problem was that when installing Apache Bench from source, I had copied over the ab executable file from httpd/support/bin/.lib/ab to ~/.local/bin. When I did that, it used the system-wide libapr instead of the one I had downloaded to httpd/srclib/apr. This caused some sort of version mismatch, I assume.
The solution was to remove my copy of ab from ~/.local/bin and instead create a script ~/.local/bin/ab with contents
#!/bin/sh
$SRC/httpd/support/ab "$#"
and make this executable with chmod a+x ~/.local/bin/ab.

standard_init_linux.go:178: exec user process caused "no such file or directory"

So I pulled the snips image from docker hub.
When I run the image, it gives me the error:
standard_init_linux.go:178: exec user process caused "no such file or directory".
Most of the solutions online seem relevant only when the image has been previously built. However, in my case, I've just pulled the image. I haven't done anything with it. When I pull the image again it says:
Status: Image is up to date for snipsdocker/platform:latest
I'm kind of inexperienced, so I have no clue as to what is happening.
Could someone help?
PS: I'm using docker on a RaspberryPi Zero
Note: This answer is applicable if you use Windows.
Background
One of the reasons that you have this issue is that the line endings in the files were converted at some point from Unix format (LF) to Windows format (CR LF).
If such conversion happens to .sh file that will be running inside Docker container, Linux will not recognize Windows format of end of line (EOL) and will treat the whole file as a single line. It will lead to an error like standard_init_linux.go:XXX: exec user process caused "no such file or directory"
Cause
The EOL conversion could happen because one of the following:
your local Git is configured to automatically convert line endings to Windows format (autocrlf = true) when you git pull sources
you saved one of the files in some editor in Windows, so it was saved with CR LF line endings
Solution
As a quick fix you can open the file in Notepad++, go to menu Edit/EOL Conversion/Unix, and then save the file
Another quick fix: use CLI tool dos2unix to convert files from command line
Change git configuration by turning off automatic conversion to Windows EOL format:
git config --global core.autocrlf input
It will change the setting globally, for all repositories on your machine.
You can also set it per repository.
See https://help.github.com/articles/dealing-with-line-endings/ for more details.

Error Installing RVM through Cygwin in Windows

I am attempting to install RVM through Cygwin, following this tutorial.
AFter creating the directory and cloning the git repository, I need to run ./osx_or_cygin_kick_off to begin the installation process.
This is the error message I am getting:
$ ./osx_or_cygwin_kick_off
./automation/rvm/rvm_install: line 2: $'\r': command not found
./automation/rvm/rvm_install: line 3: syntax error near unexpected token `$'\r''
'/automation/rvm/rvm_install: line 3: `install_rvm()
./automation/rvm/rvm_install_some_rubies: line 2: $'\r': command not found
./automation/rvm/rvm_install_some_rubies: line 3: syntax error near unexpected token `$'\r''
'/automation/rvm/rvm_install_some_rubies: line 3: `install_some_rubies()
I read somewhere that converting the files to unix format via doc2unix might solve the problem, but it is only creating more error messages.
Any suggestions?
Edit:
The problem is that some Cygwin git installations try to do magic linefeed handling. To fix git so it stops mangling line endings, run:
git config --global core.autocrlf false
Original answer made more generic after comment clarification:
The file contains CRLF (\r\n) end-line sequences, which is typical on Windows. Unix doesn't like it, though; Unix (and Cygwin) want just LF (\n). I'm guessing you cut-and-pasted that file, or downloaded it through some mechanism that appended Windows line endings.
To fix files in Cygwin:
tr -d '\r' <filename >filename.tmp
Check and make sure filename.tmp looks ok, then:
mv -f filename.tmp
Alternately, do a browser download and save (rather than cut and paste), or from the Cygwin shell, download using curl or wget.
In all of the above cases, you probably won't have an executable file (just readable). You can either make it executable with:
chmod 755 filename
Or run it through the shell explicitly:
sh filename
You'll run into this problem often if you use Windows editors to manipulate your Cygwin files. Editors inside Cygwin will be fine (e.g. Vim). Optionally, many free Windows editors support Unix line endings. Notepad++ is a good one with a Unix line-ending option.

Resources