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

nimble test fails on mac: #81

Closed
timotheecour opened this issue Jan 25, 2019 · 9 comments
Closed

nimble test fails on mac: #81

timotheecour opened this issue Jan 25, 2019 · 9 comments

Comments

@timotheecour
Copy link
Contributor

timotheecour commented Jan 25, 2019

  • I'm on OSX
  • python --version
    Python 2.7.15
  • python -c 'import matplotlib; print(matplotlib.__version__)'
    2.2.2
  • which python
    /Users/timothee/homebrew//bin/python

possibly related to this: timotheecour/vitanim#5 (comment) /cc @Vindaar

$nim_D/nimpy master 2.900 $ nimble test
   Warning: Using env var NIM_LIB_PREFIX: /Users/timothee/git_clone//nim//Nim/
  Executing task test in /Users/timothee/git_clone/nim/nimpy/nimpy.nimble
Hint: used config file '/Users/timothee/git_clone/nim/Nim/config/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/.config/nim/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/git_clone/nim/Nim/config/config.nims' [Conf]
/Users/timothee/git_clone/nim/nimpy/tests/nimfrompy.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(1, 24) Warning: import os.nim instead; ospaths is deprecated [Deprecated]
/Users/timothee/git_clone/nim/nimpy/tests/nimfrompy.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(10, 30) Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated]
/Users/timothee/git_clone/nim/nimpy/tests/nimfrompy.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(805, 34) Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated]
Hint:  [Link]
Hint: operation successful (58055 lines compiled; 1.496 sec total; 91.98MiB peakmem; Debug Build) [SuccessX]
Hint: used config file '/Users/timothee/git_clone/nim/Nim/config/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/.config/nim/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/git_clone/nim/Nim/config/config.nims' [Conf]
/Users/timothee/git_clone/nim/nimpy/tests/custommodulename.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(1, 24) Warning: import os.nim instead; ospaths is deprecated [Deprecated]
/Users/timothee/git_clone/nim/nimpy/tests/custommodulename.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(10, 30) Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated]
/Users/timothee/git_clone/nim/nimpy/tests/custommodulename.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(805, 34) Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated]
Hint:  [Link]
Hint: operation successful (57710 lines compiled; 1.042 sec total; 73.898MiB peakmem; Debug Build) [SuccessX]
Tests complete!
Tests complete!
Hint: used config file '/Users/timothee/git_clone/nim/Nim/config/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/.config/nim/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/git_clone/nim/Nim/config/config.nims' [Conf]
/Users/timothee/git_clone/nim/nimpy/tests/tpyfromnim.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(1, 24) Warning: import os.nim instead; ospaths is deprecated [Deprecated]
/Users/timothee/git_clone/nim/nimpy/tests/tpyfromnim.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(10, 30) Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated]
/Users/timothee/git_clone/nim/nimpy/tests/tpyfromnim.nim(1, 1) template/generic instantiation from here
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(805, 34) Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated]
Hint:  [Link]
Hint: operation successful (57945 lines compiled; 1.226 sec total; 73.891MiB peakmem; Debug Build) [SuccessX]
Hint: /Users/timothee/git_clone/nim/nimpy/tests/tpyfromnim  [Exec]
/Users/timothee/git_clone/nim/nimpy/tests/tpyfromnim.nim(199) tpyfromnim
/Users/timothee/git_clone/nim/nimpy/tests/tpyfromnim.nim(62) test
/Users/timothee/git_clone/nim/nimpy/nimpy.nim(1018) pyImport
/Users/timothee/git_clone/nim/nimpy/nimpy/py_utils.nim(98) raisePythonError
Error: unhandled exception: <type 'exceptions.ImportError'>: cannot import name _remove_dead_weakref [Exception]
Error: execution of an external program failed: '/Users/timothee/git_clone/nim/nimpy/tests/tpyfromnim '
stack trace: (most recent call last)
/Users/timothee/git_clone/nim/nimpy/nimpy.nimble(34, 18) testTask
/Users/timothee/git_clone/nim/Nim/lib/system/nimscript.nim(241, 7) exec
/Users/timothee/git_clone/nim/Nim/lib/system/nimscript.nim(241, 7) Error: unhandled exception: FAILED: nim c -r tests/tpyfromnim.nim
  • same error after:
pip install --upgrade matplotlib
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already up-to-date: matplotlib in /Users/timothee/homebrew/lib/python2.7/site-packages (2.2.3)
Requirement already satisfied, skipping upgrade: kiwisolver>=1.0.1 in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (1.0.1)
Requirement already satisfied, skipping upgrade: numpy>=1.7.1 in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (1.15.4)
Requirement already satisfied, skipping upgrade: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (2.2.0)
Requirement already satisfied, skipping upgrade: backports.functools-lru-cache in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (1.5)
Requirement already satisfied, skipping upgrade: six>=1.10 in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (1.11.0)
Requirement already satisfied, skipping upgrade: pytz in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (2018.4)
Requirement already satisfied, skipping upgrade: subprocess32 in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (3.5.1)
Requirement already satisfied, skipping upgrade: cycler>=0.10 in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.1 in /Users/timothee/homebrew/lib/python2.7/site-packages (from matplotlib) (2.7.3)
Requirement already satisfied, skipping upgrade: setuptools in /Users/timothee/homebrew/lib/python2.7/site-packages (from kiwisolver>=1.0.1->matplotlib) (39.2.0)

diagnostic

  • let o = pyLib.PyImport_ImportModule(moduleName) fails
@yglukhov
Copy link
Owner

I think nimpy is using python3 on your system. It tries to find the most recent python version. To verify that:

import nimpy
echo pyImport("sys").path

and compare it to

python -c "import sys; print(sys.path)"

@timotheecour
Copy link
Contributor Author

doesn't look like it:

nim c -r main.nim

import nimpy
echo pyImport("sys").path
['/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/timothee/Library/Python/2.7/lib/python/site-packages', '/Users/timothee/homebrew/lib/python2.7/site-packages', '/Users/timothee/homebrew/Cellar/numpy/1.15.4_2/libexec/nose/lib/python2.7/site-packages', '/Users/timothee/homebrew/Cellar/protobuf/3.6.1.3/libexec/lib/python2.7/site-packages', '/Users/timothee/homebrew/opt/llvm_tim/lib/python2.7/site-packages', '/Users/timothee/homebrew/lib/python2.7/site-packages', '/Users/timothee/homebrew/Cellar/numpy/1.15.4_2/libexec/nose/lib/python2.7/site-packages', '/Users/timothee/homebrew/opt/llvm_tim/lib/python2.7/site-packages']
python -c "import sys; print(sys.path)"

['', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Users/timothee/homebrew/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/timothee/Library/Python/2.7/lib/python/site-packages', '/Users/timothee/homebrew/lib/python2.7/site-packages', '/Users/timothee/homebrew/Cellar/numpy/1.15.4_2/libexec/nose/lib/python2.7/site-packages', '/Users/timothee/homebrew/Cellar/protobuf/3.6.1.3/libexec/lib/python2.7/site-packages', '/Users/timothee/homebrew/opt/llvm_tim/lib/python2.7/site-packages', '/Users/timothee/homebrew/lib/python2.7/site-packages', '/Users/timothee/homebrew/Cellar/numpy/1.15.4_2/libexec/nose/lib/python2.7/site-packages', '/Users/timothee/homebrew/opt/llvm_tim/lib/python2.7/site-packages']

@yglukhov
Copy link
Owner

Ok. And python -c 'import numpy' doesn't raise any errors?

@timotheecour
Copy link
Contributor Author

it doesn't

@yglukhov
Copy link
Owner

Googling around this problem is vaguely described as a conflict between the system python and brew python. Could it so happen that python binary comes from the system python, and the dylib loaded by nimpy comes from brew, or the other way around?

@narimiran
Copy link
Contributor

Could it so happen that python binary comes from the system python, and the dylib loaded by nimpy comes from brew, or the other way around?

If so, it might be connected to #46

@yglukhov
Copy link
Owner

If so, it might be connected to #46

Yeah, but not really, because any installed python dll should work. And this is just a system (brew?) bug.

@timotheecour
Copy link
Contributor Author

update: this is related to https://stackoverflow.com/questions/47658596/strange-mixing-of-system-homebrew-python-with-lldb
this works:

PATH=/usr/bin:$PATH nimble test

but not ideal obviously as it has other side effects

@yglukhov
Copy link
Owner

Well I don't see a way to fix this properly. Even with python selection functionality in place, there still remains the possibility to hit this. Because, let me repeat it, I treat this as an os/environment issue. But feel free to prove me wrong.

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

No branches or pull requests

3 participants