- it does install, but I am not able to import it :-(.
- Example:
- pwd
/Users/DM/work/trunk/nim
- nimble list -i # *No previously existing entry*
Warning: Using project local deps mode
- nimble install db_connector
Warning: Using project local deps mode
Downloading https://github.com/nim-lang/db_connector using git
Warning: The package has no tagged releases, downloading HEAD instead.
Verifying dependencies for [email protected]
Installing [email protected]
Success: db_connector installed successfully
- nimble list -i # *Yes it is installed*
Warning: Using project local deps mode
db_connector [(version: 0.1.0, checksum: 05c335ec678614b973d8a80651971e0719045d14)]
- inim # *Now try to import it*
Nim 0.6.1
Nim Compiler Version 2.0.0 [MacOSX: amd64] at /usr/local/bin/nim
nim> import db_connector
/private/var/folders/8l/vhg5vggj04g77ny91mlgzn680000gn/T/inim_1694301779.nim(8,
8) Error: cannot open file: db_connector # Can't find it :-(
- Checking where the files were actually installed:
- Macintosh HD
- Users
- DM # My user directory
- work
- trunk
- nim
- nimbledeps
- pkgs2
- db_connector-0.1.0-...
db_connector.nimble
# Background:
Warning: Using project local deps mode nimble v0.14.2 compiled at 2023-08-01 01:01:02
git hash: couldn't determine git hash
Thanks. I tried that too. But no luck.
inim
👑 INim 0.6.1
Nim Compiler Version 2.0.0 [MacOSX: amd64] at /usr/local/bin/nim
nim> import db_sqlite
/private/var/folders/8l/vhg5vggj04g77ny91mlgzn680000gn/T/inim_1694328954.nim(8, 8) Error: cannot open file: db_sqlite
import dbconnector/db_sqlite
/private/var/folders/8l/vhg5vggj04g77ny91mlgzn680000gn/T/inim_1694329501.nim(8, 19) Error: cannot open file: dbconnector/db_sql
Thanks... your are very correct...but I as reported above... that doesn't work for me either.
In desperation I manually relocated the installed files from ...pkgs2 to ~/.nimble/pkgs and ...
inim
👑 INim 0.6.1
Nim Compiler Version 2.0.0 [MacOSX: amd64] at /usr/local/bin/nim
nim> import db_connector/db_sqlite
nim> let db = open("localhost", "user", "password", "dbname")
nim> db.close()
nim> quit
So my current question is:
Why Nim (on my machine) can't locate Nimble installed packages from where nimble installed them?
I'm thinking some messed up configuration on my part... but I don't remember doing any :-(
Any suggestions on trouble shooting this?
Thanks Araq.
$home isn't oddly isn't defined my zsh shell:
echo "*${home}*"
**
I tried try creating a nim.cfg in my home (/Users/DM) directory with
nimblepath="/Users/DM/.nimble/pkgs2/"
(BTW there wasn't already one)
and it made no difference.
I also did likewise in the repository directory (/Users/DM/work/trunk/nim)
I also interated on on both /pkgs and /pkgs2 for nimblepath with no change :-(
---
Just to clarify, I supplied a little more detail hoping it might shed some light on this particular anomaly.
pwd
/Users/DM/work/trunk/nim
There are no overriding nim.cfg., nimble* or nimbledep*
ls -la nim*.cfg
zsh: no matches found: *.cfg
ls -ls nimble*.*
zsh: no matches found: nimble*.*
tree --charset ascii -L 1 ~/.nimble
/Users/DM/.nimble
\|-- bin
\|-- nimbledata2.json
\|-- pkgs
\\`-- pkgs2
Current contents of pkgs: (historically installed by Nim 1.6.x and earlier versions nimble);
/Users/DM/.nimble/pkgs
\|-- ansiparse-0.2.0
\|-- argparse-3.0.0
\|-- at-0.1.0
\|-- balls-3.3.7
\|-- base-3.5.1
\|-- bearssl-0.1.5
\|-- benchy-0.0.1
\.\.\.
\|-- with-0.4.0
\|-- ws-0.5.0
\|-- yaml-1.1.0
\|-- zippy-0.10.10
\`-- zstd-0.6.0
The above pkgs2 subdirectory is empty
ls .nimble/pkgs2
<< No files/directories listed>>
The previously installed modules are accessible via Nim's import.
inim
INim 0.6.1
Nim Compiler Version 2.0.0 [MacOSX: amd64] at /usr/local/bin/nim
nim> import argparse
nim> import benchy
nim> exit
So far... so good.... but Nimble itself doesn't seem to know about the previously installed packages!!!
nimble list -i
<< doesn't list anything>>
nimble path argparse
nimble.nim(912) listPaths
Error: At least one of the specified packages was not found
nimble path benchy
nimble.nim(912) listPaths
Error: At least one of the specified packages was not found
If I use nimble to install a new module:
cd ~
nimble install db_connector
Downloading https://github.com/nim-lang/db_connector using git
Warning: The package has no tagged releases, downloading HEAD instead.
Verifying dependencies for [email protected]
Installing [email protected]
Success: db_connector installed successfully.
Nimble globally knows about it :-)
nimble list -i
db_connector [(version: 0.1.0, checksum: 05c335ec678614b973d8a80651971e0719045d14)]
cd ~/work/trunk/nim
nimble list -i
db_connector [(version: 0.1.0, checksum: 05c335ec678614b973d8a80651971e0719045d14)]
And so does Nim :-)
inim
INim 0.6.1
Nim Compiler Version 2.0.0 [MacOSX: amd64] at /usr/local/bin/nim
nim> import db_connector/db_sqlite
nim> exit
My question is now:
How to I get Nimble to recognize the existence of previously installed pkgs as well as the newly install pkgs2.
I naively tried copying the contents of pkgs into pkgs2 but no joy.
nimble list -i
Tip: 1 messages have been suppressed, use --verbose to show them.
tables.nim(235) raiseKeyError
Error: key not found: metaData
Thanks to all who are helping me with this... hopefully we can get to the bottom it.
https://nim-lang.org/blog/2023/08/01/nim-v20-released.html
Tool changes
Essentially, 'pkgs' directory is for Nim 1.0, 'pkgs2' is for Nim 2.0. If you don't use Nim 1.0, delete modules in the old 'pkgs' directory and reinstall everything you need with nimble.
Would you/anyone happen to have a link to release notes, or some other artefact that I should have reviewed before upgrading to V2 and its associated toolset? I’ve had so few problems with backwards compatibility to-date that I think I’ve become quite complacent / lazy :-(
I can’t be the only one bitten by this!