0

i'm on win7/64, and have some pythons already, but want to be installing mosek to a new WinPython

>where python
C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe
C:\Python27\python.exe
C:\Program Files (x86)\LilyPond\usr\bin\python.exe

i'm following these instructions

>cd C:\Program Files\Mosek\7\tools\platform\win64x86\python\2

>python setup.py build --build-base c:\Users\nlab install --user
running build
running build_py
creating c:\Users\nlab\lib
creating c:\Users\nlab\lib\mosek
copying mosek\array.py -> c:\Users\nlab\lib\mosek
copying mosek\__init__.py -> c:\Users\nlab\lib\mosek
creating c:\Users\nlab\lib\mosek\fusion
copying mosek\fusion\SolverInfo.py -> c:\Users\nlab\lib\mosek\fusion
copying mosek\fusion\Utils.py -> c:\Users\nlab\lib\mosek\fusion
copying mosek\fusion\__init__.py -> c:\Users\nlab\lib\mosek\fusion
running install
running install_lib
creating C:\Users\nlab\AppData\Roaming\Python
creating C:\Users\nlab\AppData\Roaming\Python\Python27
creating C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages
creating C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek
copying c:\Users\nlab\lib\mosek\array.py -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek
creating C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\fusion
copying c:\Users\nlab\lib\mosek\fusion\SolverInfo.py -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\fusion
copying c:\Users\nlab\lib\mosek\fusion\Utils.py -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\fusion
copying c:\Users\nlab\lib\mosek\fusion\__init__.py -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\fusion
copying c:\Users\nlab\lib\mosek\__init__.py -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek
byte-compiling C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\array.py to array.pyc
byte-compiling C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\fusion\SolverInfo.py to SolverInfo.pyc
byte-compiling C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\fusion\Utils.py to Utils.pyc
byte-compiling C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\fusion\__init__.py to __init__.pyc
byte-compiling C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\__init__.py to __init__.pyc
running install_data
copying C:\Program Files\Mosek\7\tools\platform\win64x86\python\2\..\..\bin\mosek64_7_1.dll -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek
copying C:\Program Files\Mosek\7\tools\platform\win64x86\python\2\..\..\bin\mosekglb64_7_1.dll -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek
copying C:\Program Files\Mosek\7\tools\platform\win64x86\python\2\..\..\bin\mosekxx7_1.dll -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek
copying C:\Program Files\Mosek\7\tools\platform\win64x86\python\2\..\..\bin\libiomp5md.dll -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek
copying C:\Program Files\Mosek\7\tools\platform\win64x86\python\2\..\..\..\..\..\license.pdf -> C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek
running install_egg_info
Writing C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\Mosek-7.1.31-py2.7.egg-info
Please review the MOSEK license conditions in license.pdf

that created and used C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\ but i want C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\Lib\site-packages\

i tried using WinPython's exe explicitly:

>C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe setup.py build --build-base c:\Users\nlab install --user
running build
running build_py
running install
running install_lib
running install_data
running install_egg_info
Removing C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\Mosek-7.1.31-py2.7.egg-info
Writing C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\Mosek-7.1.31-py2.7.egg-info
Please review the MOSEK license conditions in license.pdf

but that doesn't seem to help

user1441998
  • 459
  • 4
  • 14
  • currently: `>set PYTHONPATH` gives `PYTHONPATH=` – user1441998 May 22 '15 at 02:51
  • what does ```python -c "__import__("""mosek""").Env()" ``` and ```C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe -c "__import__("""mosek""").Env()"``` give as output ? – dermen May 22 '15 at 03:01
  • `C:\Users\nlab>python -c "__import__("""mosek""").Env()"` gives `Traceback (most recent call last): File "", line 1, in File "C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\mosek\__init __.py", line 639, in raise ImportError('Failed to import dll "%s"' % __libname) ImportError: Failed to import dll "mosekxx7_1.dll"` but `C:\Users\nlab>C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64 \python.exe -c "__import__("""mosek""").Env()"` doesn't return anything? – user1441998 May 22 '15 at 03:47
  • so the second command gave no output ? – dermen May 22 '15 at 03:50
  • Can you open a python terminal using ```C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe``` and then run ```import sys``` and then ```sys.prefix``` and see what that prints ? – dermen May 22 '15 at 03:53
  • correct -- made me wonder if that means it worked -- checked in WinPython's IPython console, and it worked!?!? `import mosek` `import picos;picos.tools.available_solvers()` gives `['cvxopt', 'mosek7']` BUT if i look in WinPython's regular python console (i'm never sure of the difference), `import mosek` gives `Traceback (most recent call last): File "", line 1, in ImportError: No module named mosek` and picos only reports cvxopt as an available solver. so why is it only half working, and why does it even half work if it was put into the wrong site-packages? – user1441998 May 22 '15 at 03:53
  • hmm, run the Ipython and do ```import sys``` then ```sys.prefix```, that should tell you where mosek is being installed. Then try the same for the regular python. Not sure why they would differ.. – dermen May 22 '15 at 03:55
  • actually, your setup.py options are whats causing the issue. Just run ```C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe setup.py install``` and that should do the trick. – dermen May 22 '15 at 04:04
  • regular: `>>> import sys; sys.prefix 'C:\\Users\\nlab\\Downloads\\WinPython-64bit-2.7.9.5\\python-2.7.9.amd64'` and ipython is same: `'C:\\Users\\nlab\\Downloads\\WinPython-64bit-2.7.9.5\\python-2.7.9.amd64'` restarting WinPython makes it work in both consoles. hrmph. so why does it work when it's in `C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages` and not `C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\Lib\site-packages` – user1441998 May 22 '15 at 04:05
  • why do mosek's official instructions (linked in OP) say i need the other options? – user1441998 May 22 '15 at 04:07
  • The problem is that you installed ```mosek``` into ```C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages\``` . You did this by using the ```--user``` option I believe. If you just remove ```user``` and install, then it should install into ```C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\Lib\site-pac‌​kages```. – dermen May 22 '15 at 04:09
  • And also, if you are in the directory ```C:\Users\nlab\AppData\Roaming\Python\Python27\site-packages``` when you open a python terminal, then you will be able to import the libraries inside regardless of which python you installed them under, but they won't be guaranteed to work properly. If you install them correctly with a given python, however, you should be able to import ```mosek``` from any directory from said python. – dermen May 22 '15 at 04:10
  • the instructions are for users who do not have root access on their computers. – dermen May 22 '15 at 04:13
  • i was worried that `--user` was required by mosek's license... the instructions don't say anything about admin privileges etc... anyway, what would have been the right thing to do from the beginning? specify the full path to the python.exe i wanted? is there a way to tell it which site-packages i want it to use explicitly? – user1441998 May 22 '15 at 04:17

1 Answers1

1

I believe it is your setup.py options which are causing the error. Specifically the user option will install into a specific directory linked to your user profile

https://docs.python.org/2/install/#alternate-installation-the-user-scheme

, regardless of what's linked to the WinPython. This is for users who do not have write privileges in system directories. If you want to link the install to your WinPython, then run

C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe setup.py install

And if you want to be sure it installs in the correct location, use the --prefix option

https://docs.python.org/2/install/#alternate-installation-windows-the-prefix-scheme

e.g.

python.exe setup.py install --prefix="C:\Users\nlab\Downloads\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\"

... but this shouldn't be necessary as that is just the default prefix associated with this particular WinPython.

dermen
  • 5,252
  • 4
  • 23
  • 34
  • is there a way to install (and specify options) from a setup.py from within python console? do i not need `--build-base`? would that also be for users with limited privileges? – user1441998 May 22 '15 at 04:23
  • I do not think this is necessary on your system (see https://docs.python.org/2/install/#splitting-the-job-up ) , but ```--build-base``` does seem to be useful to users with limited privileges. And I wouldn't try to install into a package using the python console (you might b able to using ```os.system``` or a ```subprocess``` module, but I would not bother. I think it is best to do this from the DOS terminal or by using package manager – dermen May 22 '15 at 04:37