Where is the cython pyximport compilation?

My cython / pyximport code cython very well on a read / write file system.

But (for testing purposes), I need to try it on a read- only file system.

How to change cython / pyximport temporary directory ? (where does he do this work, ie compilation on the fly?)

How to set this "working directory" somewhere else than the current directory, for example /tmp/ (which is not ro , but rw )?


Traceback:

 !! File "/usr/lib/python2.7/site-packages/Cython/Distutils/build_ext.py", line 301, in cython_sources self.mkpath(os.path.dirname(target)) !! File "/usr/lib/python2.7/distutils/cmd.py", line 352, in mkpath dir_util.mkpath(name, mode, dry_run=self.dry_run) !! File "/usr/lib/python2.7/distutils/dir_util.py", line 76, in mkpath "could not create '%s': %s" % (head, exc.args[-1])) !! ImportError: Building module samplerbox_audio failed: ["DistutilsFileError: could not create '/root/.pyxbld': Read-only file system\n"] 
+6
source share
1 answer

From help(pyximport.install)

By default, compiled modules will go to .pyxbld in the user's home directory. Passing another path as build_dir override this.

so pass build_dir as an argument when you call pyximport.install so that it uses your read / write system.

+12
source

Source: https://habr.com/ru/post/986670/


All Articles