Ask Your Question

phn's profile - activity

2020-04-29 06:30:15 +0200 received badge  Taxonomist
2015-05-26 18:24:02 +0200 received badge  Famous Question (source)
2015-01-07 17:29:14 +0200 received badge  Notable Question (source)
2014-09-11 19:12:21 +0200 received badge  Popular Question (source)
2014-02-06 19:12:55 +0200 answered a question Accessing resources from another project

I confirm that the method above does work when the path listed in local.pth is in the same project as the one where python is executed.

What does not work for me is to add a path to a project "B" folder when I'm running python from project "A". I checked and double-checked the spelling in local.pth.

2014-02-05 11:25:54 +0200 received badge  Nice Answer (source)
2014-02-05 11:23:56 +0200 received badge  Student (source)
2014-02-03 14:50:37 +0200 received badge  Self-Learner (source)
2014-02-03 14:50:37 +0200 received badge  Teacher (source)
2014-02-03 12:46:15 +0200 asked a question Accessing resources from another project

I'm thinking of organizing my code as follows:

  • Project A (private) has all the libraries and common python modules.
  • Projects B, C, D (public) have mostly notebooks that make use of python modules in (A)

I added the absolute path to project A modules in a local.pth file of project B:

~/.local/lib/python2.7/site-packages/local.pth

Also did chmod 755 (read and execute by everyone) on all resources in project A. Testing with python in a console (project B) shows that the path to project A is not added to sys.path. The same works fine when I'm in project A. Any idea how to proceed?

2014-02-03 12:23:47 +0200 answered a question [Solved] run-time link issue in IPython Notebook

Solution: I use the rpath link option to store the entire path to the .so library. The relevant part of the setup.py file is as follows:

import os
from os.path import expanduser

HOME = expanduser('~')
QL_LIBS = os.join(HOME, "directory of my .so library")

then create link arguments:

extra_link_args = ['-Wl,-rpath,'+QL_LIBS]

check the result with ldd: you will find that the entire path to the .so library has been stored.

2014-02-02 19:46:10 +0200 received badge  Editor (source)
2014-02-02 19:45:11 +0200 asked a question [Solved] run-time link issue in IPython Notebook

I'm trying to run QuantLib + cython wrappers (pyql) in a IPython notebook. From the console, I can:

  • build QuantLib and run the test suite
  • build pyql and run the test suite (path to QuantLib.so set with -rpath arguments in g++)
  • use ldd to verify that the run-time links are resolved
  • invoke ipython (from the console) and run tests, works fine. The key point being run-time link to the QuantLib.so library.

Now I open an IPython notebook, cd to the proper directory, try to import a module, get an import error (libQuantLib.so.0 not found). Same problem if I use a notebook without sage enhancements.

Is the ipython interpreter used in a notebook somehow different from the one invoked in a console? More generally, what is the canonical way to register a dynamic library for use in a notebook, given that "ldconfig -n <path>" is not an option?

2014-02-02 19:25:09 +0200 received badge  Supporter (source)
2014-02-02 16:36:11 +0200 commented answer How to upgrade a python package with pip?

This worked: sage --sh then pip install --user --upgrade cython -> installed cython 0.20 (feb 2, 2014) Thanks a lot!

2014-02-02 16:35:42 +0200 received badge  Scholar (source)
2014-02-02 16:35:42 +0200 marked best answer How to upgrade a python package with pip?

Try sage --python pip install ... or sage --sh followed by pip install .... Either of these will run Sage's version of Python.

2014-02-01 20:01:43 +0200 asked a question How to upgrade a python package with pip?

I'm trying to set up QuantLib and PyQL on cloud.sagemath. QuantLib builds out of the box. For PyQL, I need Cython >0.18; installed version is 0.15. If I try a local install:

pip install --user --upgrade --ignore-installed cython

pip tries to uninstall the system version, which of course fails. Any idea how to proceed?