After building from source. How do I use built version with pip and virtualenv?


#1

So this is a python newbie question. After successfully building from source on my mac. I then did:

cd python
sudo python setup.py install

In the mxnet folder where the project was built.

I can then run the examples etc fine.

I understand this setup.py installs mxnet in my global python.

If I then later want to set up a project with virtualenv and then do pip install. How can I specify I want this specific version of mxnet that I built from source?


#2

Once you have activated your virtualenv or conda env, go to the python/ folder under the incubator-mxnet folder where you built mxnet from source and run

pip install -e .

You can find this instruction under the Linux Build from Source selection of this page.


#3

@safrooze now that Turi 4.1 is out I was attempting this again. However when trying to pip install my own compiled mxnet into the Turi virtual env I’m running it comes back with:

    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/hn/2_p67dxn4w710gwncfhjn30m0000gn/T/pip-C__5ZC-build/setup.py", line 46, in <module>
        LIB_PATH = libinfo['find_lib_path']()
      File "/private/var/folders/hn/2_p67dxn4w710gwncfhjn30m0000gn/T/pip-C__5ZC-build/mxnet/libinfo.py", line 59, in find_lib_path
        'List of candidates:\n' + str('\n'.join(dll_path)))
    RuntimeError: Cannot find the files.
    List of candidates:
    /private/var/folders/hn/2_p67dxn4w710gwncfhjn30m0000gn/T/pip-C__5ZC-build/mxnet/libmxnet.dylib
    /private/var/folders/hn/2_p67dxn4w710gwncfhjn30m0000gn/T/pip-C__5ZC-build/mxnet/../../lib/libmxnet.dylib
    /private/var/folders/hn/2_p67dxn4w710gwncfhjn30m0000gn/T/pip-C__5ZC-build/mxnet/../../build/libmxnet.dylib
    /private/var/folders/hn/2_p67dxn4w710gwncfhjn30m0000gn/T/pip-C__5ZC-build/mxnet/libmxnet.so
    /private/var/folders/hn/2_p67dxn4w710gwncfhjn30m0000gn/T/pip-C__5ZC-build/mxnet/../../lib/libmxnet.so
    /private/var/folders/hn/2_p67dxn4w710gwncfhjn30m0000gn/T/pip-C__5ZC-build/mxnet/../../build/libmxnet.so

Any pointers to why this would be?


#4

@helloniklas sorry for delayed response. I’ve never used Turi. Did you find a solution? If not, try setting LD_LIBRARY_PATH environment variable to the directory that contains libmxnet.so (under lib/ folder of mxnet source tree).