Sublime + IJulia: ZMQ library not found - sublimetext3

I installed IJulia package for sublime. When I start sublime, I got ZMQ shared library not found....
I try to find ZMQ from Julia:
julia> using ZMQ
julia> println(ZMQ.zmq)
C:\Users\Nick\.julia\v0.3\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\libzmq.DLL
I open Package settings - IJulia - user, modified the path in this line:
"zmq_shared_library": "~/.julia/v0.3/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libzmq.dll",
Restart sublime, I got this:
Unable to find an entry point ... libstdc++-6.dll
What's should I do?
Environment:
Windows 7, 64-bit
Julia v"0.3.8"
Sublime text 3
Update - kernel died
I found that there's an issue here:
https://github.com/quinnj/Sublime-IJulia/issues/64
To quote:
tildebyte commented on 28 Feb
Answering my own question: libstdc++-6.dll exists in 2 places: Sublime
Text 3 Beta\Data\Packages\IJulia\windeps and
.julia\v0.3\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin.
i.e., the version shipping with the plugin doesn't match the one
libzmq is linked against. I fixed it by copying down ZMQ's libstdc DLL
from mingw\bin into the plugin's windeps dir. So, yes, I concur:
#M-Marz libzmq is probably mismatched to the plugin OR he's got
another libzmq somewhere in the path, which ST is finding first.
So I tried to copy the libstdc++-6.dll from .julia\v0.3\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin to Sublime Text 3 Beta\Data\Packages\IJulia\windeps.
Sublime stops complain ZMQ library not found or cannot found entry point; however, when I try Ctrl-shift-p, open ijulia, I got ***kernel died***.
I searched my system, found that there's several libstdc++-6.dll for several individual applications: Julia, Evernote, VLC ...
How could I figure out what's wrong?
Update - "kernel died" Solved
I found the same problem here:
https://github.com/quinnj/Sublime-IJulia/issues/60
Thanks to #GregPlowman:
Finally, after much playing around, I managed to get Sublime-IJulia
working on Windows.
Seems some file paths are processed differently. (Maybe some by
Windows directly, others by Julia with some parsing?).
In any case, care needs to be taken with file paths on Windows:
absolute or relative
quoting entire pathname (especially important if path name has spaces)
path separators ( forward or back slash / vs \ )
I played around with many combinations and got really confused.
However I think the Julia executable path should be absolute, quoted
(if spaces in path name) and use backslashes. ZMQ and kernel pathnames
can be relative, should be unquoted, and use forward slash separator.
Here's the Windows extract from Sublime user settings file that worked
for me:
"windows": {
"zmq_shared_library": "~/.julia/v0.3/ZMQ/deps/usr/lib/libzmq.dll",
"commands": [
{
"command_name": "default",
"julia": "\"C:\Program Files\Julia-0.3.5\bin\julia.exe\"",
"julia_args": "",
"ijulia_kernel": "~/.julia/v0.3/IJulia/src/kernel.jl"
}
] }
Note that to quote path name use \", and to use backslash path
separator use \.
Cheers, Greg
Lesson learnt
When an opensourse software goes wrong, the first place to find solution is the issues from github. Thanks to #tidlebyte and #GregPlowman. (Both of them fired the issue, and found solution themselves.)

Brief answer:
Solution to ZMQ Library Not Found
Step 1:
(1) Copy everything from IJulia package settings - default to package settings - user.
(2) Find ZMQ lib path
julia> using ZMQ
julia> ZMQ.zmq
"C:\\Users\\Nick\\.julia\\v0.3\\WinRPM\\deps\\usr\\x86_64-w64-mingw32\\sys-root\\mingw\\bin\\libzmq.DLL"
(3) Modify the zmq_shared_library path according to (2).
Step 2: Copy libstdc++-6.dll from C:\\Users\\Nick\\.julia\\v0.3\\WinRPM\\deps\\usr\\x86_64-w64-mingw32\\sys-root\\mingw\\bin\\ to C:\Users\Nick\AppData\Roaming\Sublime Text 3\Packages\IJulia\windeps. (Yes, overwrite.)
Solution to Kernel Died
Modify the path in IJulia package settings - user
"windows": {
"zmq_shared_library": "C:/Users/Nick/.julia/v0.3/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libzmq.DLL",
"commands": [
{
"command_name": "default",
// "julia": "julia-readline.exe",
"julia": "\"C:\\application\\Julia-0.3.8\\bin\\julia.exe\"",
"julia_args": "",
"ijulia_kernel": "~/.julia/v0.3/IJulia/src/kernel.jl"
}
]
}
Pay special attention to the quotes on path. Especially \" for quote the whole path.
Again, thanks to #tidlebyte and #GregPlowman for their early exploration and solution. If anybody got stuck on any of above steps, please let me know.

Related

Unresolved import error - Python virtual-environment [duplicate]

I am using the following setup
macOS v10.14 (Mojave)
Python 3.7.1
Visual Studio Code 1.30
Pylint 2.2.2
Django 2.1.4
I want to use linting to make my life a bit easier in Visual Studio Code. However, for every import I have states "unresolved import". Even on default Django imports (i.e. from django.db import models).
I presume it is because it is not seeing the virtual environment Python files.
Everything works just fine, but it's starting to get annoying.
The interpreter choices I have are all system versions of Python. It does not seem to see my virtual environment Python at all (it is not in the same directory as my workspace, so that part makes sense).
If I set up the python.PythonPath in the settings.json file, it just ignores it and does not list my virtual environment path as an option. I also tried setting it up in my global Python settings, but it also does not show up.
Is there a quick fix to get it working?
The accepted answer won't fix the error when importing own modules.
Use the following setting in your workspace settings .vscode/settings.json:
"python.autoComplete.extraPaths": ["./path-to-your-code"],
Reference: Troubleshooting, Unresolved import warnings
In your workspace settings, you can set your Python path like this:
{
"python.defaultInterpreterPath": "/path/to/your/venv/bin/python",
}
Alternative way: use the command interface!
Cmd/Ctrl + Shift + P → Python: Select Interpreter → choose the one with the packages you look for:
This issue has already been opened on GitHub:
Python unresolved import issue #3840
There are two very useful answers, by MagnuesBrzenk and SpenHouet.
The best solution for now is to create a .env file in your project root folder. Then add a PYTHONPATH to it like this:
PYTHONPATH=YOUR/MODULES/PATH
And in your settings.json add:
"python.envFile": ".env"
When I do > reload window that fixes it.
Reference: Python unresolved import issue #3840, dkavraal's comment
None of the solutions worked except this one. Replacing "Pylance" or "Microsoft" in the settings.json solved mine.
"python.languageServer": "Jedi"
You need to select the interpreter associated with the virtual environment.
Click here (at the bottom status bar):
And just select the virtual environment you are working with. Done.
Sometimes, even with the interpreter selected, it won't work. Just repeat the process again and it should solve it.
If you have this code in your settings.json file, delete it:
{
"python.jediEnabled": false
}
If you are more visual like myself, you can use the Visual Studio Code configurations in menu File → Preferences → Settings (Ctrl + ,). Go to Extensions → Python.
In the section Analysis: Disabled, add the suppression of the following message: unresolved-import:
I was able to resolved this by enabling jedi in .vscode\settings.json
"python.jediEnabled": true
Reference from https://github.com/Microsoft/vscode-python/issues/3840#issuecomment-456017675
I wonder how many solutions this problem have (or have not), I tried most of the above, nothing worked, the only solution that worked is to set the python language server to Jedi, instead of Microsoft in the settings.json file:
"python.languageServer": "Jedi"
None of the previous answers worked for me. Adding both of the lines below to my settings.json file did, however.
"python.analysis.disabled": [
"unresolved-import"
],
"python.linting.pylintArgs": ["--load-plugin","pylint_protobuf"]
The first line really just hides the linting error. Certainly not a permanent solution, but de-clutters the screen.
This answer gave me the second line: VS Code PyLint Error E0602 (undefined variable) with ProtoBuf compiled Python Structure
Maybe someone who understands Python more than me can explain that one more.
Okay, so 2 years down the line, I have ran into this annoying problem. All I can seen here are some really complicated workarounds. Here are easy to follow steps for anyone else who might just run into this later on:
at the bottom of VS Code where you see the Python version listed, just click there
Select Interpreter windows is going to appear
click on the first option that says "Select Interpreter Path" and navigate to the folder path which has your Virtual Environment
That's all you need to do and avoid tampering with those settings in VS Code which might get very complicated if not handled with caution.
My solution
This solution is only for the current project.
In the project root, create folder .vscode
Then create the file .vscode/settings.json
In the file setting.json, add the line (this is for Python 3)
{
"python.pythonPath": "/usr/local/bin/python3",
}
This is the example for Python 2
{
"python.pythonPath": "/usr/local/bin/python",
}
If you don't know where your Python installation is located, just run the command which python or which python3 on the terminal. It will print the Python location.
This example works for dockerized Python - Django.
I was facing the same problem while importing the project-related(non standard) modules.
Detailed explanation of the problem
Directory structure:
Project_dir:
.vscode/settings.json
dir_1
> a
> b
> c
dir_2
> x
> y
> z
What we want:
Project_dir
dir_3
import a
import y
Here "import a" and "import y" fails with following error:
Import "dir_1.a" could not be resolvedPylancereportMissingImports
Import "dir_2.y" could not be resolvedPylancereportMissingImports
What worked for me:
Appending the top directory which contains the modules to be imported.
In above example add the follwoing "Code to append" in ".vscode/settings.json"
Filename:
.vscode/settings.json
Code to append:
"python.analysis.extraPaths": [dir_1, dir_2]
The solution from Shinebayar G worked, but this other one is a little bit more elegant:
Copied from Python unresolved import issue #3840:
Given the following example project structure:
workspaceRootFolder
.vscode
... other folders
codeFolder
What I did to resolve this issue:
Go into the workspace folder (here workspaceRootFolder) and create a .env file
In this empty .env file, add the line PYTHONPATH=codeFolder (replace codeFolder with your folder name)
Add "python.envFile": "${workspaceFolder}/.env" to the settings.json
Restart Visual Studio Code
To me the problem was related with the project that I was working on. It took me a while to figure it out, so I hope this helps:
Original folder structure:
root/
__init__.py # Empty
folder/
__init__.py # Empty
sub_folder_b/
my_code.py
sub_folder_c/
another_code.py
In another_code.py:
from folder.sub_folder_b import my_code.py
This didn't trigger the intellisense in Visual Studio Code, but it did execute OK.
On the other hand, adding "root" on the import path, did make the intellisense work, but raised ModuleNotFoundError when executing:
from root.folder.sub_folder_b import my_code.py
The solution was to remove the _init_.py file inside the "folder" directory, leaving only the _init_.py located at /root.
This works for me:
Open the command palette (Ctrl + Shift + P) and choose "Python: Select Interpreter".
Doing this, you set the Python interpreter in Visual Studio Code.
None of the answers here solved this error for me. Code would run, but I could not jump directly to function definitions. It was only for certain local packages. For one thing, python.jediEnabled is no longer a valid option. I did two things, but I am not sure the first was necessary:
Download Pylance extension, change python.languageServer to "Pylance"
Add "python.analysis.extraPaths": [ "path_to/src_file" ]
Apparently the root and src will be checked for local packages, but others must be added here.
I am using the following setup: (in Apr 2021)
macos big sur
vscode
Anaconda 3 (for environment)
And I faced this error during starting of the Django.
So, I follow these steps and this error is resolved.
Steps are given in these screenshots:
Open settings (workspace)
Follow this screenshot to open Python Path
Now, click Edit in settings.json
Make path like given in this screenshot /opt/anaconda3/bin/python
5. Now, save this settings.json file.
6. Restart the vscode
Also, intellisense might not work for some time hold on wait for some time and then restart again then vscode reads file for new path.
That happens because Visual Studio Code considers your current folder as the main folder, instead of considering the actual main folder.
The quick way to fix is it provide the interpreter path to the main folder.
Press Command + Shift + P (or Ctrl + Shift + P on most other systems).
Type Python interpreter
Select the path where you installed Python in from the options available.
Changing
Python:Language Server
to 'Jedi' worked for me.
It was 'Windows' initially.
For me, it worked, if I setup the paths for python, pylint and autopep8 to the local environment paths.
For your workspace add/change this:
"python.pythonPath": "...\\your_path\\.venv\\Scripts\\python.exe",
"python.linting.pylintPath": "...\\your_path\\.venv\\Scripts\\pylint.exe",
"python.formatting.autopep8Path": "...\\your_path\\.venv\\Scripts\\autopep8.exe",
Save and restart VS Code with workspace.
Done!
I have a different solution: my Visual Studio Code instance had picked up the virtualenv stored in .venv, but it was using the wrong Python binary. It was using .venv/bin/python3.7; using the switcher in the blue status bar.
I changed it to use .venv/bin/python and all of my imports were resolved correctly.
I don't know what Visual Studio Code is doing behind the scenes when I do this, nor do I understand why this was causing my problem, but for me this was a slightly simpler solution than editing my workspace settings.
In case of a Pylint error, install the following
pipenv install pylint-django
Then create a file, .pylintrc, in the root folder and write the following
load-plugins=pylint-django
I have faced this problem in three ways. Although for each of them a solution is available in the answers to this question, I just thought to put it all together.
First I got an "Unresolved Import" while importing some modules and I noticed that my installations were happening in global pip instead of the virtual environment.
This issue was because of the Python interpreter. You need to select the interpreter in Visual Studio Code using Shift + Ctrl + P and then type Select Python Interpreter. Select your venv interpreter here.
The second issue was: The above change did not resolve my issue completely. This time it was because of file settings.json. If you don't have the settings.json file in your project directory, create one and add the following line in that:
{
"python.pythonPath": "apis/bin/python"
}
This will basically tell Visual Studio Code to use the Python interpreter that is in your venv.
The third issue was while importing a custom Python module or file in another program. For this you need to understand the folder structure. As Python in venv is inside bin, you'll need to specify the folder of your module (most of the time the application folder). In my case it was app,
from app.models import setup_db
Verbally, import setup_db from models.py resides in the app folder.
If you are using pipenv then you need to specify the path to your virtual environment.in settings.json file.
For example :
{
"python.pythonPath":
"/Users/username/.local/share/virtualenvs/Your-Virual-Env/bin/python"
}
This can help.
If someone happens to be as moronic as me, the following worked.
Old folder structure:
awesome_code.py
__init__.py
src/
__init__.py
stuff1.py
stuff2.py
New structure:
awesome_code.py
src/
__init__.py
stuff1.py
stuff2.py
How to avoid warning
Please note that this is just skipping the warning not resolving it.
First of all open visual studio code settings in json and add following arguments after "[python]":{}
"python.linting.pylintArgs": ["--rep[![enter image description here][1]][1]orts", "12", "--disable", "I0011"],
"python.linting.flake8Args": ["--ignore=E24,W504", "--verbose"]
"python.linting.pydocstyleArgs": ["--ignore=D400", "--ignore=D4"]
This has helped me to avoid pylint warnings in VSCode.
I have resolved import error by Ctrl + Shift + P.
Type "Preferences settings" and select the option Preferences Open Settings (JSON)
And add the line "python.pythonPath": "/usr/bin/"
So the JSON content should look like:
{
"python.pythonPath": "/usr/bin/"
}
Keep other configuration lines if they are present.
This should import all modules that you have installed using PIP for autocomplete.

Building Julia on sublime text 3 gives WinError 2

I am very new to Julia and wanted to use Sublime Text 3.
When I try to run the simplest code, something like this happens:
You can see that Julia is added to the path.
I constantly got zmq issue at the start of Sublime Text. I tweaked the windows part of IJulia settings to take care of the zmq error.
{
"zmq_shared_library": "C:/Users/reha/.julia/v0.5/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libzmq.dll",
"commands": [
{
"command_name": "default",
"julia": "julia.exe",
"julia_args": "",
"ijulia_kernel": "C:/Users/reha/.julia/v0.5/IJulia/src/kernel.jl"
}
]
However, Sublime keeps not building my .jl files. I have no issue with .py files. They work as they are supposed to. What is the problem here?
EDIT: It worked when I saved the file in the julia directory. For some reason, I failed to add Julia to the path, however you can see that it is in the path in the provided screenshot.
I found out that adding Julia to path is not enough to add Julia to path. The address of libzmq should also be added to the path.
Now Julia files work from any location.

Sublime text configuration can't find nodejs because of space in filename

"windows": "C:/Program Files (x86)/nodejs",
This is what i thought would have worked, but it doesn't. I think it's due to space in between.
I installed some addon in sublimetext 3, which required nodejs. However, it says nodejs not found at specified path. Then i put the correct path. But i still get the same error.
How do you deal with this space problem... because in cli you could put it under quotes to compensate for spaces.

How do I specify the path to node in SublimeText3 for Sublime-JSHint plugin in Windows

After installing node.js then the Sublime-JSHint plugin on Windows XP with SublimeText3, I get the following error:
"Node.js was not found in the default path. Please specify the location."
This is a known configuration issue and is documented by the author, however I can't work out how to specify the path. Can anyone tell me how to specify the path in Windows XP?
https://github.com/victorporof/Sublime-JSHint#oh-noez-command-not-found
I have tried
"node_path": "/Program Files/nodejs",
"node_path": "C:/Program Files/nodejs",
"node_path": "/Program Files/nodejs/node.exe",
"node_path": "C:/Program Files/nodejs/node.exe",
This works for me:
"node_path": "C:/Program Files/nodejs/node.exe"
Try using
"node_path": "/c/Program Files/nodejs/node.exe"
and make sure this option is in your Packages/User/JSHint.sublime-settings file. I'm not sure why your last setting didn't work, because it is also in a valid format, but hopefully using the Cygwin-style path will work.
This finally worked for me:
"node_path": "\"C:/Program Files (x86)/nodejs/node.exe\"",
I'm on Windows 7, so node was installed in Program Files (x86). Just knock of the " (x86)" part for if node is installed in Program Files.
I basically had to start the cmd application in Windows and type in commands until I found one that spit out the Node help text:
"c:/Program Files (x86)/nodejs/node.exe" --help
I had to encase the file path in double quotes because the file path had space characters and parenthesis in it. The "node_path" config setting also needed the file path encased in double quotes, which had to be escaped.
I found an another issue that causes to show that error. Its on registry editor . HKEY_CURRENT_USER\Software\Microsoft\Command Processor here I set AutoRun key to load c:\profile.bat where I added sublime path run sublime from cmd. But when I open cmd its through error ( its actually done by powershell ). After deleting that key node.js path working just fine. Hope this will help someone.
I was having this issue with html-css-js.prettify. In the end none of these issues worked for me and I had to comment out line 58-62 of HTMLPrettify.py so that the only line left would look up the path with the line...
node = settings.get("node_path")
I restarted SublimeText and it started working.
I imagine a similar solution might work for JSHint.
I just change in the python script and asign my node path to node_path instead of get_node_path(). Or you can set get_node_path() to return C:\\DevTools\\nodejs\\node.exe
%APPDATA%\Sublime Text 2\Packages\HTML-CSS-JS Prettify\HTMLPrettify.py
line 81 def run_script_on_file(self, temp_file_path):
try:
node_path = "C:\\DevTools\\nodejs\\node.exe"
Well, you should
Ctrl + ` // or View => Show Console
to see what's wrong.
Mostly, it's not the Node.js path problem
For example, what I could see is
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcd in position 0: ordinal not in range(128)
So, I searched it, and solved it with:
// HTMLPrettify.py
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sublime, sublime_plugin
import os, sys, subprocess, codecs, webbrowser
reload(sys) # NEW LINE !!! <================
sys.setdefaultencoding("utf-8") # NEW LINE !!! <================
Well, after that, it's OK.
In my case this setting DOES NOT work
"node_path": "/usr/lib/nodejs/node-v6.11.0/bin/node",
but this WORKS
"node_path": { "linux" : "/usr/lib/nodejs/node-v6.11.0/bin/node" }
This change has to be made in the JSHint.sublime-settings file.
Hope this helps! Although changes are effective right away, I would try restarting the Sublime after the change to make sure if this resolves your problem.
What worked for me:
I searched 'node.exe' in both program files and program files(x86).
Then I got a file named node.exe in some folder I copied its path and pasted like this
/path/node.exe
Note: you have to change \ to /

Cygwin make error : *** target pattern contains no `%'

I got this error while (re)building, using cygwin make.exe version :3.81.
Error : *** target pattern contains no `%'.
This error is due to a presence of a ":". Therefore it no longer supports windows paths.
You need to download version 3.80 and replace the make.exe in the \bin directory.
Apparently it needs cygintl12.dll too.
rollback to make 3.80 (Geant4)
cd /usr/bin
mv make.exe make_381.exe
wget http://geant4.cern.ch/support/extras/cygwin/make.exe
chmod +x make.exe
install libintl2 from cygwin setup for the required cygintl-2.dll
I got the same error when trying to build a project on Linux or OSX, that was previously built on a Windows machine and had some .o.d files hanging around in the output folder.
Once I manually deleted the .o.d files the problem was resolved. Apparently the "Clean" command of my IDE (CodeLite in this case) wasn't deleting the .o.d files.
Most likely due to the presence of a colon following a drive letter. For example consider
build : $(NativeHeaders)/*
If
NativeHeaders=../../../cpp/generated
then all is well, but
NativeHeaders=C:/dev/folder/cpp/generated
results in the error that you get.
I was getting this error because I didn't have a Tab (\t) character at the beginning of my commands. I had expandtab in my vim set so it was replacing a tab character with 4 spaces. When I turned that off and changed spaces to a tab it was fixed
I had the target pattern contains no '%' error while building with the Android NDK using cygwin.
I found the following link helpful:
Errors Generated by Make
‘missing target pattern. Stop.’
‘multiple target patterns. Stop.’
‘target pattern contains no `%'. Stop.’
‘mixed implicit and static pattern rules. Stop.’
These are generated for malformed static pattern rules. The first means there’s no pattern in the target section of the rule; the second means there are multiple patterns in the target section; the third means the target doesn’t contain a pattern character (%); and the fourth means that all three parts of the static pattern rule contain pattern characters (%)–only the first two parts should. If you see these errors and you aren’t trying to create a static pattern rule, check the value of any variables in your target and prerequisite lists to be sure they do not contain colons. See Syntax of Static Pattern Rules.
And so, my solution included changing my system variables from Windows format to Unix format like so:
Instead of C:\Android\android-ndk-r10c, I used /cygdrive/c/Android/android-ndk-r10c for the NDK path.
Similarly, I changed the NDK project path to /cygdrive/c/Android/project/src/main/jni.
In my case I was using CMake under Cygwin when I got this error. It turned out the Windows version of CMake was executed. Subsequently, Windows paths were used in the make file. I installed Cygwin's version of CMake through the setup program and got it working.
I had this problem on Linux when the build directory contained a ":" caused by doing a mercurial checkout which created a directory named "server:port".
I had to change the following in my make file to be compatible with Make_381:
before:
ARDUINO_BASE_DIR = C:\programs/arduino
now:
ARDUINO_BASE_DIR = \\programs/arduino
Try this if you're running Eclipse C/C++ and referencing files from Cygwin under Windows, make sure c:/cygwin/bin or c:/cygwin64/bin comes after your preferred compiler tools in your Windows Path environment.
Example:
Path = ;C:\yagarto\bin;C:\yagarto-tools\bin;C:\cygwin64\bin;
After making the changes, exit Eclipse and restart for it to take effect (simply restarting Eclipse without exiting won't fix the problem.
In my project, obj folder was probably corrupted and I was getting this error. Manually deleted obj folder. Then ndk-build completed fine.

Resources