MOSEK / Mosek.pip

PIP MOSEK installer
MIT License
17 stars 10 forks source link

Cannot import mosek #9

Closed shimazing closed 7 years ago

shimazing commented 7 years ago

import mosek /Users/mazing/.pyenv/versions/cnn-hw1/lib/python2.7 Traceback (most recent call last): File "", line 1, in File "/Users/mazing/.pyenv/versions/cnn-hw1/lib/python2.7/site-packages/mosek/init.py", line 304, in library,dlldir = loadmosek("mosekxx8_0") File "/Users/mazing/.pyenv/versions/cnn-hw1/lib/python2.7/site-packages/mosek/init.py", line 299, in loadmosek raise ImportError('Failed to import dll "%s" from %s' % (__libname,dlldir)) ImportError: Failed to import dll "libmosekxx8_0.dylib" from None

I got this message Does anybody know what's the problem?

ulfworsoe commented 7 years ago

I is possible that the libraries are not correctly installed. Could you do an

ls -l /Users/mazing/.pyenv/versions/cnn-hw1/lib/python2.7/site-packages/mosek/

to check if libmosek64.8.0.dylib and libmosekxx8_0.dylib are present. if they are, do a

otool -L /Users/mazing/.pyenv/versions/cnn-hw1/lib/python2.7/site-packages/mosek/libmosekxx8_0.dylib

to see if it can find the dependant libraries.

sparaflAsh commented 7 years ago

I'm having the same problem with pyenv. Any clue on what is the solution?

pip install --user git+http://github.com/MOSEK/Mosek.pip
Collecting git+http://github.com/MOSEK/Mosek.pip
  Cloning http://github.com/MOSEK/Mosek.pip to /tmp/pip-e40c7chc-build
Requirement already satisfied: numpy>=1.4 in /home/psimeone/.pyenv/versions/3.6.0/envs/Venv36/lib/python3.6/site-packages (from Mosek==8.0.73)
Installing collected packages: Mosek
  Running setup.py install for Mosek ... done
Successfully installed Mosek-8.0.83

Everything seem to work fine and before doing this I also tried directly the python setup.py install --user from the installation folder.

If I pip freeze the API doesn't show up.

 pip freeze
CVXcanon==0.1.1
cvxpy==0.4.10
cycler==0.10.0
decorator==4.1.2
dill==0.2.7.1
ecos==2.0.4
fastcache==1.0.2
matplotlib==2.0.2
multiprocess==0.70.5
networkx==1.11
numpy==1.13.1
pandas==0.20.3
pyparsing==2.2.0
python-dateutil==2.6.1
pytz==2017.2
scikit-learn==0.18.2
scipy==0.19.1
scs==1.2.6
six==1.10.0
toolz==0.8.2
sparaflAsh commented 7 years ago

Ah. Found the solution. Just remove the --user from the command. The libraries end up in the wrong folder under ./local and they don't pop into ./pyenv

ulfworsoe commented 7 years ago

The README assumes that the Python installation is global. I have added a note the README about local Python installations.