nim-lang / nimble

Package manager for the Nim programming language.
https://nim-lang.github.io/nimble/index.html
Other
1.25k stars 191 forks source link

Nimble install fails on missing lib/system.nim #220

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi all, I've just updated my nim installation to the latest(0.13.1) and the nimble install fails with the following message:

FAILURE: Could not read package info file in /home/steven/.nimble/nimble.nimble;
  Reading as ini file failed with: 
    Invalid section: .
  Evaluating as NimScript file failed with: 
    Error: cannot open '/home/steven/.nimble/lib/system.nim'.
Error: execution of an external program failed: '/home/steven/.nimble/src/nimble install'

System props: Linux Mint 17.1, intel, x86_64, Nim_0.13.1

dom96 commented 8 years ago

How are you installing Nimble?

ghost commented 8 years ago

@dom96 like this

git clone https://github.com/nim-lang/nimble.git .nimble
cd .nimble
git clone -b v0.13.0 --depth 1 https://github.com/nim-lang/nim vendor/nim
nim -d:release c -r src/nimble install

and this:

git clone https://github.com/nim-lang/nimble.git
cd nimble
git clone -b v0.13.0 --depth 1 https://github.com/nim-lang/nim vendor/nim
nim -d:release c -r src/nimble install

and both of them failed

ghost commented 8 years ago

@dom96 but "cd .Nim ; nim e install_nimble.nims" works - is it the new recommended way?

aurora commented 8 years ago

@stevendobay i have the same issue installing as described in the README on osx. But where is .Nim directory located you describe in your latest comment?

dom96 commented 8 years ago

You can use nim e install_nimble.nims but I don't personally recommend it.

Some more questions:

Keep in mind that Nimble installs packages to $HOME/.nimble (~/.nimble), so if you are cloning Nimble into ~/.nimble bad things will happen.

@aurora Also, please let me know how you installed Nim.

dom96 commented 8 years ago

I just attempted to reproduce this and couldn't. My Nim is in ~/projects/nim with ~/projects/nim/bin added to my PATH.

I executed the following commands:

cd /tmp
git clone https://github.com/nim-lang/nimble.git
cd nimble
git clone -b v0.13.0 --depth 1 https://github.com/nim-lang/nim vendor/nim
nim -d:release c -r src/nimble install

I can then execute which nimble and get /Users/dom/.nimble/bin/nimble.

This is on Mac OS X 10.11.3.

aurora commented 8 years ago

My nim is located in /usr/local/bin (other stuff accordingly in /usr/local/lib/nim. I built nim as described on the website from github and used the install script generated by make install to install it accordingly.

dom96 commented 8 years ago

@aurora I would recommend removing Nim from /usr/local/bin and /usr/local/lib/nim and simply adding it to your PATH like I did. Nim is known to misbehave when its installed in that manner. Of course it really shouldn't and these installation problems need to be fixed.

dom96 commented 8 years ago

Actually, I have a feeling that this might have already been fixed in Nim's devel branch. Did you build the master branch?

aurora commented 8 years ago

No, i am on devel as you recommended a while ago to me on irc ;-).

dom96 commented 8 years ago

I see. That sucks, must still be a bug then :(

aurora commented 8 years ago

I just moved the nim installation to ~ and indeed,

nimble installed successfully.

I can live with this until nim 1.0 ;-). Thanks for your help!

dom96 commented 8 years ago

Great :)

ghost commented 8 years ago

@dom96 my .Nim folder is under the home directory(~) and nim(/home/steven/.Nim/bin/nim) has been set up as an alternative(sudo update-alternative...). Cloning nimble to ~/nimble doesn't solve the problem.

dom96 commented 8 years ago

@stevendobay That may the problem, can you instead add /home/steven/.Nim/bin/nim to your PATH and try again?

pandada8 commented 8 years ago

met same issue, find a solution:

cd /tmp
git clone https://github.com/nim-lang/nimble.git
cd nimble
git clone -b v0.13.0 --depth 1 https://github.com/nim-lang/nim vendor/nim
ln -s vendor/nim/lib .
nim -d:release c -r src/nimble install

worked with nim installed by brew. Nim 0.13.0 with osx 10.11.4, nim located at /usr/local/bin/nim

yinso commented 8 years ago

Have the same issue back in March and had to postpone trying to use Nim due to this issue.

Finally have time to revisit this, and good to see that it wasn't just me having the issue.

@pandada8 - verified that your solution works, thanks.

jyapayne commented 8 years ago

I had the same issue and @pandada8's solution worked for me. I was using nim compiled from the devel branch as of this morning and instead of using

git clone -b v0.13.0 --depth 1 https://github.com/nim-lang/nim vendor/nim

I used

git clone -b devel --depth 1 https://github.com/nim-lang/nim vendor/nim

My installation was indeed /usr/local/bin, however I had the same issue when having nim installed from my home directory using the PATH environment var.

dom96 commented 8 years ago

I'm still not sure what the problem is here. If you have latest Nim (from devel branch) and latest Nimble then everything should work.

I have tested Nimble on my MacBook and on a fresh Arch Linux install and was not able to reproduce this :\

dom96 commented 8 years ago

Also, the "download a copy of Nim into vendor/nim" shouldn't be necessary anymore.

jyapayne commented 8 years ago

What does printenv | sort show your environment variables to be?

dom96 commented 8 years ago
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.uMzkdn4nUp/Render
DISPLAY=/private/tmp/com.apple.launchd.I5613DhGUI/org.macosforge.xquartz:0
GEM_HOME=/Users/dom/.rvm/gems/ruby-2.3.0
GEM_PATH=/Users/dom/.rvm/gems/ruby-2.3.0:/Users/dom/.rvm/gems/ruby-2.3.0@global
HOME=/Users/dom
IRBRC=/Users/dom/.rvm/rubies/ruby-2.3.0/.irbrc
LANG=en_GB.UTF-8
LC_CTYPE=en_GB.UTF-8
LESS=-R
LOGNAME=dom
LSCOLORS=Gxfxcxdxbxegedabagacad
MY_RUBY_HOME=/Users/dom/.rvm/rubies/ruby-2.3.0
OLDPWD=/Users/dom/projects/nimble
PAGER=less
PATH=/Users/dom/.rvm/gems/ruby-2.3.0/bin:/Users/dom/.rvm/gems/ruby-2.3.0@global/bin:/Users/dom/.rvm/rubies/ruby-2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dom/projects/nim/bin:/Users/dom/.nimble/bin:/Users/dom/.rvm/bin
PWD=/Users/dom/projects/nimble
RUBY_VERSION=ruby-2.3.0
SHELL=/bin/zsh
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.qQqL3m8IEM/Listeners
TERM=xterm-256color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=361.1
TERM_SESSION_ID=6D595627-AFDF-414A-AB4A-417A4678AAB4
TMPDIR=/var/folders/qs/3mwpxj8s1td75h2bby7g18xw0000gn/T/
USER=dom
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
ZSH=/Users/dom/.oh-my-zsh
_=/usr/bin/printenv
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
_system_arch=x86_64
_system_name=OSX
_system_type=Darwin
_system_version=10.11
rvm_bin_path=/Users/dom/.rvm/bin
rvm_path=/Users/dom/.rvm
rvm_prefix=/Users/dom
rvm_version=1.27.0 (latest)
jyapayne commented 8 years ago

And where is your nim installation?

dom96 commented 8 years ago

/Users/dom/projects/nim and /Users/dom/projects/nim/bin is in my PATH.

dom96 commented 8 years ago

So, if you remove the vendor/nim dir do you simply get the error mentioned in the OP? Can you verify that you've got the latest Nimble commit?

jyapayne commented 8 years ago

Interesting. You have pretty much the same setup as I do. What's more interesting is that with a fresh clone of the nimble repo, I can't reproduce the error either. It's possible when I produced the error that my environment was slightly different since I still had my copy of /usr/local/bin/nim (which I changed as per your advice).

Looking closer, for me to reproduce the exact error, I have to do these steps:

  1. Edit my PATH to not include the path to the Nim project directory
  2. Install Nim to /usr/local/bin with ./koch install /usr/local/bin
  3. Follow the exact instructions on the nimble page

After this, I get the error:

FAILURE: Could not read package info file in /home/joey/Downloads/nimble/nimble.nimble;
  Reading as ini file failed with: 
    Invalid section: .
  Evaluating as NimScript file failed with: 
    Error: cannot open '/home/joey/Downloads/nimble/lib/system.nim'.
Error: execution of an external program failed: '/home/joey/Downloads/nimble/src/nimble install'

So it seems to me that the nimble source code is expecting lib/system.nim to exist in the root nimble directory, when it should be looking in vendor/nim. Hopefully this helps debug the issue :)

jyapayne commented 8 years ago

If I remove vendor/nim in the situation above, without the Nim path, I get this error:

nimblepkg/nimscriptsupport.nim(8, 11) Error: cannot open 'compiler/ast'

My nimble commit is 5deff1501a691108a16095e37f053e8d62738f4c dated at what looks like this morning.

dom96 commented 8 years ago

Yay. I can reproduce it. Thank you!

jyapayne commented 8 years ago

Yay :)

dom96 commented 8 years ago

@jyapayne Should hopefully work now, wanna give it a go? :)

jyapayne commented 8 years ago

Yep, it worked like a charm! :)

dom96 commented 8 years ago

Awesome :D

Thanks for testing!

jyapayne commented 8 years ago

No problem! Glad to help scratch an itch :)