Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to evaluate .nimble file #696

Closed
readmodifywrite opened this issue Aug 27, 2019 · 37 comments
Closed

fails to evaluate .nimble file #696

readmodifywrite opened this issue Aug 27, 2019 · 37 comments

Comments

@readmodifywrite
Copy link

On Linux Mint 19.2 and nim 0.20.2.

I'm using an empy project with a basic .nimble file:

# Package

version     = "0.1.0"
author      = "Your Name"
description = "Example .nimble file."
license     = "MIT"

# Deps

requires "nim >= 0.10.0"

nimble is unable to parse the file:

nimble check --debug
     Debug: Executing nim e --hints:off --verbosity:0 -p:/tmp/nimblecache /home/jeremy/nim/temp/temp_5682.nims /tmp/nimble_5682.out printPkgInfo
     Error: Could not validate package:
        ... Could not read package info file in /home/jeremy/nim/temp/temp.nimble;
        ...   Reading as ini file failed with: 
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with: 
        ...     /bin/sh: 1: nim: not found
        ... printPkgInfo() failed.

I've tried deleting the cache as noted in #693.
Also ensured nim is on my PATH.

@genotrance
Copy link
Contributor

Can you please share your Nim and nimble versions with -v?

@readmodifywrite
Copy link
Author

readmodifywrite commented Aug 27, 2019

Nim Compiler Version 0.20.2 [Linux: amd64]

Compiled at 2019-07-17
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 88a0edba4b1a3d535b54336fd589746add54e937
active boot switches: -d:release


nimble v0.10.2 compiled at 2019-08-27 14:42:27
git hash: couldn't determine git hash

Installed via choosenim

@readmodifywrite
Copy link
Author

Same error on macOS 10.14.6 as well.

@genotrance
Copy link
Contributor

v0.20.2 shipped with an older version of Nimble. Use koch --latest nimble and try again.

@readmodifywrite
Copy link
Author

readmodifywrite commented Sep 2, 2019

That yields a new error. Tested on the v0.20.2 tag and on master.

koch --latest nimble
git clone https://github.com/nim-lang/nimble.git dist/nimble
Cloning into 'dist/nimble'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 3694 (delta 0), reused 6 (delta 0), pack-reused 3685
Receiving objects: 100% (3694/3694), 1.27 MiB | 4.92 MiB/s, done.
Resolving deltas: 100% (2311/2311), done.
git checkout -f master
Already on 'master'
Your branch is up to date with 'origin/master'.
git pull
Already up to date.
bin/nim c -o:bin/nimble --noNimblePath --nilseqs:on -d:release dist/nimble/src/nimble.nim
Hint: used config file '/home/jeremy/nim/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/jeremy/nim/nim.cfg' [Conf]
Hint: used config file '/home/jeremy/nim/Nim/dist/nimble/src/nimble.nim.cfg' [Conf]
Hint: used config file '/home/jeremy/nim/Nim/config/config.nims' [Conf]
/home/jeremy/nim/Nim/lib/system/fatal.nim(3, 11) Error: cannot open file: /home/jeremy/nim/Nim/dist/nimble/src/panicoverride
FAILURE

@genotrance
Copy link
Contributor

Can you also share the steps of how you got to v0.20.2?

@brentp
Copy link

brentp commented Sep 2, 2019

I am seeing this error also on 0.20.2 on linux.

brentp@lorax:~$ nimble -v
nimble v0.10.2 compiled at 2019-08-26 17:25:54
git hash: couldn't determine git hash
brentp@lorax:~$ nim --version
Nim Compiler Version 0.20.2 [Linux: amd64]
Compiled at 2019-07-17
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 88a0edba4b1a3d535b54336fd589746add54e937
active boot switches: -d:release


brentp@lorax:~$ nimble install nimble
Downloading https://github.com/nim-lang/nimble using git
       Tip: 2 messages have been suppressed, use --verbose to show them.
     Error: Could not read package info file in /tmp/nimble_21309/githubcom_nimlangnimble/nimble.nimble;
        ...   Reading as ini file failed with: 
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with: 
        ...     
        ... printPkgInfo() failed.

@brentp
Copy link

brentp commented Sep 2, 2019

I fixed by doing:

cd $nimble_src_dir
nim c -d:release src/nimble
cp src/nimble $(which nimble)

and then my nimble works fine. It was originally created (and just updated recently) with sh build_all.sh from nim-lang devel.

@brentp
Copy link

brentp commented Sep 4, 2019

I have just done git pull, sh build_all.sh, nimble install -y nimble without problem, so somehow my issue is resolved.

@genotrance
Copy link
Contributor

@readmodifywrite - any update on your end? What OS are you seeing the issue?

@dom96
Copy link
Collaborator

dom96 commented Sep 21, 2019

Seems like there is a couple of problems here. Best thing to do is just wait for another Nimble/Nim release (they are just around the corner) and try with choosenim again.

@abulka
Copy link

abulka commented Oct 7, 2019

After updating to nim 1.0 nimble seems to be broken on my Mac, with "cannot read package file errors".

Attempting to install nimpy:

nimble install nimpy
Downloading https://github.com/yglukhov/nimpy using git
       Tip: 1 messages have been suppressed, use --verbose to show them.
     Error: Could not read package info file in /var/folders/8h/n6qvp62x7pz1gx3d2sc2h8sh0000gn/T/nimble_8021/githubcom_yglukhovnimpy/nimpy.nimble;
        ...   Reading as ini file failed with: 
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with: 
        ...     /private/var/folders/8h/n6qvp62x7pz1gx3d2sc2h8sh0000gn/T/nimble_8021/githubcom_yglukhovnimpy/nimpy_8021.nims(15, 19) Warning: import os.nim instead; ospaths is deprecated [Deprecated]
        ... [Package]
        ... version: """0.1.0"""
        ... author: """Yuriy Glukhov"""
        ... description: """Nim python integration lib"""
        ... license: """MIT"""
        ... backend: """c"""
        ... [Deps]
        ... requires: "nim >= 0.17.0"
        ... printPkgInfo() failed.

Attempting to upgrade nimble itself:

$ nimble install nimble
Downloading https://github.com/nim-lang/nimble using git
       Tip: 2 messages have been suppressed, use --verbose to show them.
     Error: Could not read package info file in /var/folders/8h/n6qvp62x7pz1gx3d2sc2h8sh0000gn/T/nimble_8096/githubcom_nimlangnimble/nimble.nimble;
        ...   Reading as ini file failed with: 
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with: 
        ...     [Package]
        ... version: """0.11.0"""
        ... author: """Dominik Picheta"""
        ... description: """Nim package manager."""
        ... license: """BSD"""
        ... srcdir: """src"""
        ... backend: """c"""
        ... installExt: "nim"
        ... bin: "nimble"
        ... [Deps]
        ... requires: "nim >= 0.13.0"
        ... printPkgInfo() failed.

Attempting to install inim

$ nimble install inim
Downloading https://github.com/AndreiRegiani/INim using git
       Tip: 2 messages have been suppressed, use --verbose to show them.
     Error: Could not read package info file in /var/folders/8h/n6qvp62x7pz1gx3d2sc2h8sh0000gn/T/nimble_8172/githubcom_AndreiRegianiINim/inim.nimble;
        ...   Reading as ini file failed with: 
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with: 
        ...     [Package]
        ... version: """0.4.1"""
        ... author: """Andrei Regiani"""
        ... description: """Interactive Nim Shell / REPL / Playground"""
        ... license: """MIT"""
        ... srcdir: """src"""
        ... backend: """c"""
        ... bin: "inim"
        ... [Deps]
        ... requires: "nim >= 0.17.0, cligen >= 0.9.15"
        ... /private/var/folders/8h/n6qvp62x7pz1gx3d2sc2h8sh0000gn/T/nimble_8172/githubcom_AndreiRegianiINim/inim_8172.nims(5, 22) Warning: imported and not used: 'strutils' [UnusedImport]
        ... printPkgInfo() failed.

My nim is installed via brew. Reporting the version number for nim is ok but there is some weird error when nimble reports its version git hash: couldn't determine git hash - not sure if that's relevant.

$ nim -V
Nim Compiler Version 1.0.0 [MacOSX: amd64]
Compiled at 2019-09-24
Copyright (c) 2006-2019 by Andreas Rumpf

active boot switches: -d:release -d:useLinenoise

$ nimble -V
nimble v0.11.0 compiled at 2019-09-24 03:04:27
git hash: couldn't determine git hash

So basically I'm unable to use nimble anymore and not sure how to fix the situation. Could the 1.0 release of nim have caused this?

@genotrance
Copy link
Contributor

I'll investigate this on Mac but I'm the meantime you can try @Araq's suggestion to install without brew or update your nimble with koch --latest nimble.

@abulka
Copy link

abulka commented Oct 10, 2019

@genotrance Didn't have koch and the koch doco page strangely, has no mention of how to install it. So I uninstalled brew's nim (and associated nimble) and compiled nim from source using the instructions on the nim official github page https://github.com/nim-lang/Nim - turns out it was pretty easy, and after adding the relevant bin to my path, nimble is now running correctly.

The only extra thing that I had to do is add ~/.nimble/bin to my path, otherwise I couldn't launch my nimble built programs like inim and nake. Whilst this step is mentioned in the nimble readme, it is only in the context of using nimble install nimble (which ironically works without having ~/.nimble/bin in my path) - arguably adding ~/.nimble/bin to one's path is a fundamental step for using artifacts installed by nimble and should be mentioned more prominently in the readme.

@genotrance
Copy link
Contributor

koch.nim is in the Nim root dir. It should be built already and you can just run it right there.

The nimble bin info is on the install page.

@Araq
Copy link
Member

Araq commented Oct 10, 2019

Slightly offtopic but I wonder why nimble install nimble is still mentioned, it cannot ever work on Windows and the official way is koch nimble or to use the Nimble that ships with Nim.

@dom96
Copy link
Collaborator

dom96 commented Oct 13, 2019

Slightly offtopic but I wonder why nimble install nimble is still mentioned

Because koch nimble isn't perfect, and your apparent perception of nimble install nimble is wrong.

How can you continue to suggest koch nimble when it only exists when building Nim from source?

it cannot ever work on Windows and the official way is koch nimble

That's wrong, it can definitely work. The only time it will fail is if overwriting the same version... that's unlikely to fix any issues anyway.

So here is the situation as far as I can see it:

  • Nim installed via package manager (brew/apt/etc):
    • koch nimble cannot be used
    • nimble can be used: nimble install nimble worth a try to resolve any issues with Nimble
  • Nim installed from source:
    • koch nimble already used, so the only thing you can really try is koch --latest nimble I guess? But that's risky in itself, since development version of Nimble might have issues of its own.
    • nimble install nimble doesn't make sense, since nimble will be beside nim.exe, but if you have ~/.nimble/bin before ~/projects/nim/bin (or wherever you've got Nim source) then it will work fine.
  • Nim installed via choosenim:
    • koch nimble cannot be used
    • nimble can be used, since choosenim installs Nim/Nimble into ~/.nimble/bin

So, since koch is unavailable most of the time, why are we pushing it as the "official" way to update Nimble?

@Araq
Copy link
Member

Araq commented Oct 15, 2019

That's wrong, it can definitely work. The only time it will fail is if overwriting the same version... that's unlikely to fix any issues anyway.

How is it wrong? Windows holds a lock onto nimble.exe and so it can't "Update itself".

@genotrance
Copy link
Contributor

If you use choosenim, if it builds from source, koch binary is there. It isn't in the path, but it is there.

If you use any of our binary distributions, win/lin today, koch is there.

I'm unsure on distro installs but koch source is also right there and you can easily compile it cause nim binary is just fine.

So regardless of methods, koch binary is available.

@dom96
Copy link
Collaborator

dom96 commented Oct 15, 2019

How is it wrong? Windows holds a lock onto nimble.exe and so it can't "Update itself".

Nimble doesn't install into the same directory when installing a new version...

@genotrance
Copy link
Contributor

One other feedback - nimble install nimble does not coexist with choosenim. If you have multiple Nim versions installed and regularly switch back and forth, it will grumble about this other nimble binary all the time and you have to be careful not to overwrite it. If you actually update the nimble binary in the toolchains directory using koch then choosenim works just fine.

gt@gt:~$ nim -v
Nim Compiler Version 0.19.6 [Linux: amd64]
Compiled at 2019-05-10
Copyright (c) 2006-2018 by Andreas Rumpf

git hash: c6f601d48ec81e0d6e052ba0d19a195b55cc68f2
active boot switches: -d:release

gt@gt:~$ nimble -v
nimble v0.9.0 compiled at 2019-07-16 18:12:50
git hash: couldn't determine git hash

gt@gt:~$ nimble install nimble
Downloading https://github.com/nim-lang/nimble using git
  Verifying dependencies for nimble@0.11.0
 Installing nimble@0.11.0
   Building nimble/nimble using c backend
   Warning: Symlink already exists in /home/gt/.nimble/bin/nimble. Replacing.
   Success: nimble installed successfully.
      Hint: This package requires some external dependencies.
      Hint: To install them you may be able to run:
      Hint:   sudo apt-get install libssl-dev

gt@gt:~$ nimble -v
nimble v0.11.0 compiled at 2019-10-15 19:48:57
git hash: 4007b2a778429a978e12307bf13a038029b4c4d9

gt@gt:~$ choosenim 0.20.2
    Prompt: Symlink for 'nimble' detected in '/home/gt/.nimble/bin'. Can I remove it? [y/N]
    Answer: N
   Switched to Nim 0.20.2

gt@gt:~$ nimble -v
nimble v0.11.0 compiled at 2019-10-15 19:48:57
git hash: 4007b2a778429a978e12307bf13a038029b4c4d9

gt@gt:~$ choosenim 0.19.6
    Prompt: Symlink for 'nimble' detected in '/home/gt/.nimble/bin'. Can I remove it? [y/N]
    Answer: y
    Removed symlink pointing to /home/gt/.nimble/pkgs/nimble-0.11.0/nimble
  Installed component 'nimble'
   Switched to Nim 0.19.6

gt@gt:~$ nimble -v
nimble v0.9.0 compiled at 2019-07-16 18:12:50
git hash: couldn't determine git hash

@dom96
Copy link
Collaborator

dom96 commented Oct 15, 2019

@genotrance you should be able to get around that by passing -n to choosenim.

@genotrance
Copy link
Contributor

Why would I take the penalty of running choosenim with -n every single time versus using koch? I guess the only limitation right now is that koch --latest pulls HEAD and we'd want to pull latest tagged release.

We could improve koch for that or fix nimble install nimble to coexist better instead of forcing everyone to remember the -n. Regardless, nimble needs to enable cleaner updates since it is not tied to the compiler as much.

@dom96
Copy link
Collaborator

dom96 commented Oct 15, 2019

We should fix choosenim to be less naggy in this case.

@Araq
Copy link
Member

Araq commented Oct 16, 2019

Nimble doesn't install into the same directory when installing a new version...

And how does that work with the PATH?

@dom96
Copy link
Collaborator

dom96 commented Oct 17, 2019

@Araq symlink/bat file on Windows.

@wirebiter
Copy link

I had the same problem after updating from versien 0.20.2 to 1.0.2. I got errors when trying to install both nimble and serial. The solution for my installation was to erase the nimble cache:
c:\Users\kg\AppData\Local\Temp\nimblecache

After removing the cache installation of the serial module worked fine.

@dom96
Copy link
Collaborator

dom96 commented Nov 2, 2019

Might be worthwhile to implement this in Nimble: purge the cache if nimscript eval fails.

@genotrance
Copy link
Contributor

It could also fail if the nimble file has syntax errors - auto purging isn't good for that use case.

@moigagoo
Copy link

moigagoo commented Nov 2, 2019

Maybe add a command to clear cache and suggest using it on eval fail?

@dom96
Copy link
Collaborator

dom96 commented Nov 5, 2019

It could also fail if the nimble file has syntax errors - auto purging isn't good for that use case.

Auto purging certainly couldn't hurt in that case, could it?

@genotrance
Copy link
Contributor

Auto purging certainly couldn't hurt in that case, could it?

No way to debug what the error was then.

Anyway, this issue has two open items and neither submitter has provided any new information. There was a similar instance to what original submitter shared on #nim yesterday and it might be the same root cause.

@kodkuce was using Void Linux where /bin/sh => /bin/dash and his PATH wasn't set correctly for nim to be found. It didn't treat ~ as $HOME.

@dom96
Copy link
Collaborator

dom96 commented Nov 11, 2019

No way to debug what the error was then.

So we can copy the current cache somewhere and report the error as a warning with instructions on how to debug. What matters is that the tool works. It's likely that the problem is just incompatibilities between Nimble versions, solving these problems is tough and will always be a battle.

@mratsim
Copy link

mratsim commented Dec 15, 2019

I get this consistently in the CI pipeline I'm trying to setup when installing.

This means that I can't test packages unless they have no dependencies:

The build scripts are building Nim from source:

Nimble file:

# Package
version     = "0.9.41"
author      = "Charles Blake"
description = "Infer & generate command-line interace/option/argument parser"
license     = "MIT/ISC"

# Deps
requires    "nim >= 0.19.2"
skipDirs = @["test"]

I think Nimble should also have add installing popular packages as an anti-regression because AFAIK this only started to happen with 0.20.X

mratsim added a commit to mratsim/weave that referenced this issue Dec 15, 2019
mratsim added a commit to mratsim/weave that referenced this issue Dec 15, 2019
* Try to fix the "deadlock" in batch receive, somehow it's also 5% faster (to be checked in Travis, deadlock not reproduced locally)

* Ignore nimble during runs nim-lang/nimble#696

* don't auto fail due to getTicks on ARM

* Negative count is non-blocking, can be investigated later (#49)

* When using C++ we need C++11

* typo

* Make travis Arch visible

* fix arch
@genotrance
Copy link
Contributor

@mratsim - Looking at the travis file:

    - export PATH="nim-${CHANNEL}/bin${PATH:+:$PATH}"

My guess is that you are adding nim-${CHANNEL}/bin to the path but it is a relative path. Nimble calls Nim in a different subdir so the Nim binary can no longer be found.

@mratsim
Copy link

mratsim commented Dec 21, 2019

@mratsim - Looking at the travis file:

    - export PATH="nim-${CHANNEL}/bin${PATH:+:$PATH}"

My guess is that you are adding nim-${CHANNEL}/bin to the path but it is a relative path. Nimble calls Nim in a different subdir so the Nim binary can no longer be found.

This was it for POSIX. Now I just need to beat Azure pipelines paths for their Windows VM into submission.

mratsim added a commit to mratsim/weave that referenced this issue Dec 21, 2019
* Fix side-effect tracking of memory pools

* Implement windows barriers and common barrier API

* Fix barriers API

* Add affinity on windows

* Skip perf measure on windows

* Add windows and Mac Pipelines to Azure

* Try to fix setting PATH on windows (that overwrites bash.exe path)

* Reenable POSIX barriers

* echo PATH in Azure and fix caching detection of Nim binaries

* Fix OsErrorCode on Posix

* Azure task env variables on windows + linux - another try

* change the caching detection strategy

* Remove pthread_barrier_wait on Posix barriers

* Another try, why does it works on Linux and not windows? microsoft/azure-pipelines-agent#2018

* posix barrier fix

* another barrier error conversion missed

* [Azure] Try task.prependpath instead of setvariable

* pthread_barrier_init returns 0 on sucess, while windows return 1 ¯\_(ヅ)_/¯

* Update Azure badge

* posix barriers return code is negative ...

* another fix

* What do you say now Azure?

* Fix black_scholes benchmark [skip ci]

* need scheduler in parallel reduce

* Skip parallel_for test on Windows. Need nestable barrier: #51

* forgot to skip in lazyflowvar

* try to set absolute path for nimble (but already set on Azure) - nim-lang/nimble#696 (comment)

* This is my last Hurrah

* misnamed Posix -> Windows

* cache azure which doesn't respect [skip ci]

* set nim paths the windows way to please findExe / nimble

* we need to set the path in the task and for the collector

* Spray and pray

* Smells the victory
@genotrance
Copy link
Contributor

I'm tempted to close this issue since there's no info to act on. Also, errors are improved and we are quite a ways since 0.20.2 came out and several issues have since been fixed. If no objections, I will close this in a week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants