Issues with importing python 3 libraries in Sublime Text 3 - environment-variables

I'm on a Mac and I've recently added a python3 (3.6) build for Sublime 3, and it seems to work. However, when I import libraries installed with pip3, I get this strange output in the Sublime IDE.
For example, I tried importing Numpy (my script did nothing else) and I get this output:
sh: sysctl: command not found
sh: grep: command not found
sh: sw_vers: command not found
sh: grep: command not found
If I import multiple libraries, I get this output repeated once for every library that I try to import.
There is another thread here on the forum which suggests adding my path variable to the existing $PATH. I tried this and it did not work. I'm not so experienced dealing with path variables, so I'm guessing that I just failed at doing it right.
How do I solve this issue?
Thank you!
P.S. Here's the build:
"path": "/Library/Frameworks/Python.framework/Versions/3.6/bin/:$PATH",
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
edit: added the build

Related

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

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.

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

/usr/lib/x86_64-linux-gnu/libLLVM-4.0.so.1: version `LLVM_4.0' not found

I am trying to run a tool that uses Clang and LLVM. The tool name is cppgrep that is available with the docker. Please find it from the github repository - https://github.com/peter-can-talk/cppnow-2017. I have tried using Ubuntu 16.04 and 17.10, I got the same error as below:
root#522051d201d2:/home# ./cppgrep -help
./cppgrep: /usr/lib/x86_64-linux-gnu/libLLVM-4.0.so.1: version `LLVM_4.0' not found (required by ./cppgrep)
./cppgrep: /usr/lib/x86_64-linux-gnu/libclang-4.0.so.1: version `LLVM_4.0' not found (required by ./cppgrep)
root#522051d201d2:/home#
After some online search, I found that I had to setup the environment variable LD_LIBRARY_PATH. So as a first step I found the library files location in the docker, please find the output below:
root#522051d201d2:/home# find / -iname *libclang*.so*
/usr/lib/x86_64-linux-gnu/libclang-4.0.so
/usr/lib/x86_64-linux-gnu/libclang-4.0.so.1
/usr/lib/llvm-4.0/lib/libclang.so.1
/usr/lib/llvm-4.0/lib/libclang-4.0.so
/usr/lib/llvm-4.0/lib/libclang-4.0.0.so
/usr/lib/llvm-4.0/lib/libclang.so
/usr/lib/llvm-4.0/lib/libclang-4.0.so.1
/usr/lib/llvm-4.0/lib/clang/4.0.0/lib/linux/libclang_rt.dyndd-x86_64.so
/usr/lib/llvm-4.0/lib/clang/4.0.0/lib/linux/libclang_rt.asan-i686.so
/usr/lib/llvm-4.0/lib/clang/4.0.0/lib/linux/libclang_rt.asan-x86_64.so
/usr/lib/llvm-4.0/lib/clang/4.0.0/lib/linux/libclang_rt.asan-i386.so
After this step, I setup the LD_LIBRARY_PATH as follows:
root#522051d201d2:/home# echo $LD_LIBRARY_PATH
/usr/lib:/usr/lib/llvm-4.0/lib/:/usr/lib/x86_64-linux-gnu/
And lastly, I have exported it using the command export LD_LIBRARY_PATH. Now, if I try to run the cppgrep tool, I am still getting the same error. The command to test the tool after building the docker is as follows:
(1) cd into the cppgrep directory, like code/cppgrep,
(2) enter the docker container and mount the folder under /home:
$ docker run -it -v $PWD:/home clang
(3) run cppgrep using ./cppgrep 'x' test.cpp command.
It is suppossed to return functions and variables that has name x.
To replicate the error, after downloading and unzipping the file from github repository, build the docker container using $ docker build -t clang . command. Then follow 1,2,3 steps in the above paragraph.
After couple of days struggle, solved it!!
My initial assumption about the reason for the error is correct. The clang-llvm environment was not available to the cppgrep tool, but I made the mistake in the way of providing the environment information to the cppgrep tool.
The answer has two steps: (1) change the Makefile to point the correct location where you have installed the llvm, in my case, I change the following line in Makefile from HEADERS := -isystem /llvm/include/ to HEADERS := -isystem /usr/lib/llvm-4.0/include/. (2) You have to compile the file again by using the make command, just enter an empty space and save the cppgrep.cpp file before giving the command, otherwise, you will get a message as make: Nothing to be done for 'all'..
That is it, now you should be able to run the cppgrep tool by running ./cppgrep 'x' test.cpp or ./cppgrep -help. For using the other tools in this docker such as ast-dump, mccabe, etc. you have to follow the same above two steps before using them.

running pdflatex through sublime text 2 does not work when I use \includegraphics

i'm running this sublime-text build script to create my pdf files with pdflatex
{
"cmd" : ["pdflatex", "${file_base_name}"],
"working_dir" : "$file_path",
"shell" : false }
The build-script works fine for creating pdfs with just text, but when I try to compile a simple .tex file using the graphicx package and try to insert a png with \includegraphics I get an errormessage:
pdflatex: relocation error: pdflatex: symbol png_set_option, version PNG16_0 not defined in file libpng16.so.16 with link time reference
[Finished in 1.0s with exit code 127]
But when I create the pdf in the shell just using - pdflatex filename it works without any problems.
I really have no clue why that is. When I use the LateXTools plugin \includegraphics is also not working, that's why I created my own build script, and sadly, it's still not working...
Does anyone know why that could be, or how to solve this problem?
This occurs as sublime provides it's own version of libpng.16.so.16
The solution I used is from the arch forums. - You replace Sublime's libpng.so with a link to your operating systems version:
cd /opt/sublime-text
sudo cp -R lib lib.bak
cd lib
sudo ln -sf /usr/lib/libpng.so libpng16.so.16.2.0

Resources