quinnj / Sublime-IJulia

An IJulia Frontend for Sublime Text 3
90 stars 16 forks source link

Build system incorrectly detected on Linux #2

Closed tomasaschan closed 10 years ago

tomasaschan commented 11 years ago

I'm running Ubuntu 13.10 with ST3, and after installing this package through Package Control and trying to build a .jl file with the Julia build system, I get the following error:

[Errno 2] No such file or directory: 'julia.bat'
[cmd: ['julia.bat', '/home/tlycken/plugg/atomfusion/A1b/a1b-tlycken.jl']]
[dir: /media/tlycken/data/.../A1b]
[path: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
[Finished]

It seems that the build system believes I am on Windows, even though I'm running Ubuntu. I haven't changed any of the package settings - the installed defaults look like this:

{
    // long comment removed for brevity
    "julia_command": {
        "unix": "julia",
        "windows": "julia.bat"
    }
}

However, the problem persists even if I copy these to the user settings file, and change the windows setting to just "julia".

quinnj commented 11 years ago

Awesome. I've been meaning to reach out to a linux user to get this working. Let me push an update really quick to see if it fixes it.

quinnj commented 11 years ago

Ok, if I understand how package control works correctly, you should be able to close sublime, open it back up and it will upgrade to the new version (I think you can watch the bottom left of the screen for updates or open up the console with ctrl+` and see if the upgrade indeed happened). This upgrade includes a bunch of fixes over the last week or two, in particular, I debugged with a mac user to get everything working, so hopefully that propagates to linux too.

tomasaschan commented 11 years ago

I don't know if I did something wrong earlier, but when I today started ST3, there was a .jl script open and after a split second I was presented with an error dialog stating that something was wrong with the "Julia.tmLanguage" file. I manually uninstalled both the IJulia package and the Julia package, and then manually installed the IJulia package again - and now running a the script with Ctrl+B works as expected =)

quinnj commented 11 years ago

Glad it's working. Could you help with a quick question? Do you have I Julia installed on your system? Could you tell if there is a shared library in your julia packages directory for zmq? Something like '.julia/ZMQ/deps/usr/lib/libzmq'? I'm trying to make sure the repl functionality works on Linux but need to know where this shared library gets put when IJulia gets installed.

tomasaschan commented 11 years ago

As noted in a thread on the mailing list (but posted here for completeness), I have

tlycken@Alfons ~ $ ls .julia/ZMQ/deps/usr/lib/
libzmq.a  libzmq.la  libzmq.so  libzmq.so.3  libzmq.so.3.0.0  pkgconfig

on my system. Both libzmq.so and libzmq.so.3 are symlinks to libzmq.so.3.0.0, and I assume the libzmq without file extension you might be missing should be the same - if I create that symlink manually and restart ST3, I get some new stuff in the command palette =)

Edit for clarification:

Before I do anything manually, I have

tlycken@Alfons ~/.julia/ZMQ/deps/usr/lib $ ls -la
total 9532
drwxr-xr-x 3 tlycken tlycken    4096 nov 18 15:56 .
drwxr-xr-x 5 tlycken tlycken    4096 nov 18 15:56 ..
-rw-r--r-- 1 tlycken tlycken 6947848 nov 18 15:56 libzmq.a
-rwxr-xr-x 1 tlycken tlycken    1010 nov 18 15:56 libzmq.la
lrwxrwxrwx 1 tlycken tlycken      15 nov 18 15:56 libzmq.so -> libzmq.so.3.0.0
lrwxrwxrwx 1 tlycken tlycken      15 nov 18 15:56 libzmq.so.3 -> libzmq.so.3.0.0
-rwxr-xr-x 1 tlycken tlycken 2790615 nov 18 15:56 libzmq.so.3.0.0
drwxr-xr-x 2 tlycken tlycken    4096 nov 18 15:56 pkgconfig

I then run

tlycken@Alfons ~/.julia/ZMQ/deps/usr/lib $ ln -s libzmq.so.3.0.0 libzmq

and there's some new options in the command palette of ST3. Searching the palette for "IJulia" I find

Sublime-IJulia: Enter
Sublime-IJulia: Open new REPL

but I can't understand how to use either of them (the first seems to do nothing, and the second opens a new untitled document which doesn't do anything - what more do I need to do to start using this?).

quinnj commented 11 years ago

Restart Sublime and then run the "Sublime-IJulia: Open new REPL" command that opens up the new view. Then open up the console with ctrl+backtick and see what kind of error is showing. That would be really helpful in knowing where this is breaking down.

tomasaschan commented 11 years ago

It's looking for some profile file in the wrong place. Stacktrace:

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 526, in run_
    return self.run()
  File "IJulia in /home/tlycken/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 243, in run
  File "IJulia in /home/tlycken/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 26, in open
  File "IJulia in /home/tlycken/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 72, in __init__
  File "ZMQ in /home/tlycken/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 37, in zmq_profile
FileNotFoundError: [Errno 2] No such file or directory: '/home/tlycken/.config/sublime-text-3/Packages/IJulia/profile-0.json'

I don't have an IJulia folder under ~.config/sublime-text-3/Packages - the only IJulia-related things I seem to have are these:

tlycken@Alfons ~ $ find .config/sublime-text-3/ -iname "*ijulia*"
.config/sublime-text-3/Packages/User/Sublime-IJulia.sublime-settings
.config/sublime-text-3/Cache/IJulia
.config/sublime-text-3/Installed Packages/IJulia.sublime-package

with the following in the subdir to Cache:

tlycken@Alfons ~ $ ls -R .config/sublime-text-3/Cache/IJulia/
.config/sublime-text-3/Cache/IJulia/:
Syntax

.config/sublime-text-3/Cache/IJulia/Syntax:
Comments.tmPreferences.cache  Julia.tmLanguage.cache
quinnj commented 11 years ago

Hmmm.......that's really weird, because I'm using the sublime-supplied function to get the packages path. What we need to find is the directory with the IJulia.py file in it. Could you see if you can find it's location?

tomasaschan commented 11 years ago

I don't seem to have it at all. sudo find / -iname "*ijulia.py*" returns zero hits. I even uninstalled and reinstalled the package, for good measure, but nothing suspicious was shown in the console and no IJulia.py file appeared.

Console output for install of the IJulia package (after restart of ST3 in between):

found 1 files for base name Default.sublime-theme
reloading Packages/User/Package Control.sublime-settings
theme loaded
reloading Packages/User/Preferences.sublime-settings
found 1 files for base name Default.sublime-theme
reloading plugin IJulia.IJulia
reloading plugin IJulia.KernelManager
reloading plugin IJulia.ZMQ
reloading plugin IJulia.__init__
generating syntax summary
generating meta info summary
found 6 files for base name Default.sublime-keymap
found 5 files for base name Main.sublime-menu
theme loaded
quinnj commented 11 years ago

Can you open the console and run the following commands and show me the output?

import sublime
sublime.installed_packages_path()
sublime.packages_path()
tomasaschan commented 11 years ago

Sure!

>>> import sublime
>>> sublime.installed_packages_path()
'/home/tlycken/.config/sublime-text-3/Installed Packages'
>>> sublime.packages_path()
'/home/tlycken/.config/sublime-text-3/Packages'
quinnj commented 11 years ago

Ok, one more thing and then I'll try to push a possible fix. Can you go to your .config/sublime-text-3/Packages directory and unzip the IJulia.sublime-package file? (If it's not there, then go to your /sublime-text-3-Installed Packages/ directory and do the same). Once unzipped, can you do an ls of the contents of the unzipped directory?

tomasaschan commented 11 years ago
tlycken@Alfons ~/.config/sublime-text-3/Installed Packages $ ls
IJulia.sublime-package  Javatar.sublime-package  Package Control.sublime-package
tlycken@Alfons ~/.config/sublime-text-3/Installed Packages $ unzip IJulia.sublime-package -d IJulia -qq
tlycken@Alfons ~/.config/sublime-text-3/Installed Packages $ cd IJulia
tlycken@Alfons ~/.config/sublime-text-3/Installed Packages/IJulia $ ls -l
total 88
-rw-rw-rw- 1 tlycken tlycken  3258 nov 25 22:47 Default Linux).sublime-keymap
-rw-rw-rw- 1 tlycken tlycken  3518 nov 25 22:47 Default (OSX).sublime-keymap
-rw-rw-rw- 1 tlycken tlycken   582 nov 25 22:47 Default.sublime-commands
-rw-rw-rw- 1 tlycken tlycken  3311 nov 25 22:47 Default (Windows).sublime-keymap
-rw-rw-rw- 1 tlycken tlycken 13182 nov 25 22:47 IJulia.py
-rw-rw-rw- 1 tlycken tlycken    82 nov 25 22:47 __init__.py
-rw-rw-rw- 1 tlycken tlycken    65 nov 25 22:47 julia-build.sublime-build
-rw-rw-rw- 1 tlycken tlycken  5540 nov 25 22:47 KernelManager.py
-rw-rw-rw- 1 tlycken tlycken  1299 nov 25 22:47 Main.sublime-menu
-rw-rw-rw- 1 tlycken tlycken   144 nov 25 22:47 package-metadata.json
-rw-rw-rw- 1 tlycken tlycken   149 nov 25 22:47 profile-0.json
-rw-rw-rw- 1 tlycken tlycken   772 nov 25 22:47 README.md
drwxr-xr-x 2 tlycken tlycken  4096 nov 26 11:11 Snippets
-rw-rw-rw- 1 tlycken tlycken   458 nov 25 22:47 Sublime-IJulia.sublime-settings
drwxr-xr-x 2 tlycken tlycken  4096 nov 26 11:11 Syntax
-rw-rw-rw- 1 tlycken tlycken  3949 nov 25 22:47 test.jl
-rw-rw-rw- 1 tlycken tlycken  5689 nov 25 22:47 ZMQ.py
quinnj commented 11 years ago

Ok, I think I've got it working (finally dusted off my old linux box and spent the morning getting everything setup). I just pushed a new release. This shouldn't require you to unzip, so you can remove and reinstall the package is probably the easiest to make sure your packages directory is clean. Let me know if this works for you.

quinnj commented 10 years ago

I just pushed a new release that allows the user to specify the zmq library path in the settings file, so hopefully that helps this along. Any update?

jpfairbanks commented 10 years ago

Ubuntu linux 13.10 with julia installed from the julia ppa stable and ijulia working on the shell


starting kernel...
cmd: julia /home/users/jfairbanks/.julia/IJulia/src/kernel.jl "/home/users/jfairbanks/.config/sublime-text-3/Packages/User/profile-1.json"
Traceback (most recent call last):
  File "IJulia in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 55, in start_kernel
  File "KernelManager in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 201, in __init__
  File "KernelManager in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 102, in __init__
NameError: global name 'zmq' is not defined

Then when I close the tab that it opened


Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 231, in on_close
    callback.on_close(v)
  File "IJulia in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 392, in on_close
  File "IJulia in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 121, in on_close
AttributeError: 'IJuliaView' object has no attribute 'kernel'
quinnj commented 10 years ago

hey @jpfairbanks, I just added some documentation to the homepage of this repo (click Sublime-IJulia above to go back to the homepage). I added the steps needed to ensure everything gets installed/built correctly. Can you look those over and let me know if you can't figure something out or it's still not working?

jpfairbanks commented 10 years ago

I got this error and a blank `IJulia 0 tab. Should the global name zmq be changed to ZMQ? or do I need to install a ZMQ plugin for sublime or sublimeREPL?

Starting IJulia backend...
Command Executed: ~/julia/julia /home/users/jfairbanks/.julia/IJulia/src/kernel.jl "/home/users/jfairbanks/.config/sublime-text-3/Packages/User/profile-0.json"
Traceback (most recent call last):
  File "IJulia in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 54, in start_kernel
  File "KernelManager in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 218, in __init__
  File "KernelManager in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 104, in __init__
NameError: global name 'zmq' is not defined
~~~'
quinnj commented 10 years ago

Do you have ZMQ installed in Julia (I know it's a little confusing....). If you open up julia from the terminal and type using ZMQ; ZMQ.zmq what does it return?

jpfairbanks commented 10 years ago

"libzmq"

On Wed, Jan 22, 2014 at 10:07 AM, Jacob Quinn notifications@github.comwrote:

Do you have ZMQ installed in Julia (I know it's a little confusing....). If you open up julia from the terminal and type using ZMQ; ZMQ.zmq what does it return?

— Reply to this email directly or view it on GitHubhttps://github.com/karbarcca/Sublime-IJulia/issues/2#issuecomment-33031055 .

quinnj commented 10 years ago

That's all it returns? No path information?

jpfairbanks commented 10 years ago

Yes I used sudo apt-get install libzmq to install it. Then used package add in Julia. On Jan 22, 2014 10:14 AM, "Jacob Quinn" notifications@github.com wrote:

That's all it returns? No path information?

— Reply to this email directly or view it on GitHubhttps://github.com/karbarcca/Sublime-IJulia/issues/2#issuecomment-33031758 .

quinnj commented 10 years ago

Ok, something else to try. Open up the sublime console (ctrl+~, cmd+` on mac). Type

import IJulia
IJulia.KernelManager.plugin_loaded()

and let me know what the output looks like. If it looks like it runs, you may also try opening the console too (ctrl+shift+p, type "open ijulia").

jpfairbanks commented 10 years ago

Cannot find the file error. I have tested ZMQ and julia-ZMQ with the test program on the github page https://github.com/JuliaLang/ZMQ.jl and it works. But zmq is not in my /usr/lib folder either

>>> import IJulia
>>> IJulia.KernelManager.plugin_loaded()
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "KernelManager in /home/users/jfairbanks/.config/sublime-text-3/Installed Packages/IJulia.sublime-package", line 18, in plugin_loaded
  File "X/ctypes/__init__.py", line 431, in LoadLibrary
  File "X/ctypes/__init__.py", line 353, in __init__
OSError: ~/.julia/ZMQ/deps/usr/lib/libzmq: cannot open shared object file: No such file or directory

The contents of that directory ~/.julia/ZMQ/deps/ contains .build.jl deps.jl

quinnj commented 10 years ago

Other linux users are saying they need to specify the ZMQ shared library extension (usually libzmq.so.3) in their settings file. If libzmq is on your path, then setting your zmq_shared_library setting to libzmq might work, otherwise I would try libzmq.so.3 or libzmq.so. If none of those work (i.e. you still get the OSError), then you may have to go to the terminal and grep -R 'libzmq' / to get the exact path to your libzmq.

jpfairbanks commented 10 years ago

Setting it to libzmq.so.3 worked!

quinnj commented 10 years ago

That's great! I'm going to add the extension to the default and make a note in the instructions and then close this. Thanks for all your patience and help in debugging!