I wrote a C++ extension and wrapped it using PyBind11 and compiled it on my Linux machine which yielded a .so file that works locally; however, I cannot upload that .so file to Colab so I tried it on Windows and got a .pyd file which does not upload either... am I doing something wrong?
Asked
Active
Viewed 1,136 times
1 Answers
0
You aren't doing anything wrong, but what method do you think that colab provides to upload system libraries? (hint: none).
You may have better luck trying to embed C code into python, i.e scipy.weave, but that still requires an environment that has access to a C compiler, which colab does not provide.
You can test if weave is provided as part of a jupyter environment as follows:
!pip install -q weave
import weave
weave.test()

Clarus
- 2,259
- 16
- 27
-
when I **!pip install -q weave** I get the following error: ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-h5b3e1jh/weave/ – Grant May 22 '19 at 22:41
-
@Griffy: Per the 2nd paragraph, google colab does not provide a C compiler which is required to compile C code. – Clarus May 23 '19 at 19:02
-
If your Colab machine is Linux-based, you can probably install your own C compiler through `apt`? Installing deps through `apt` has been done through this course's tutorial notebook: [RussTedrake/underactuated/mathematical_program.ipynb](https://colab.research.google.com/github/RussTedrake/underactuated/blob/master/src/mathematical_program_examples.ipynb#scrollTo=W4w1m572eYZ-) – eacousineau Jun 18 '19 at 12:05
-
the above Russ Tedrake link no longer active. – Chris Oct 04 '20 at 16:52