Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cythonized python.net code cannot find system assemblies #3084

Open
crayxt opened this issue Aug 19, 2019 · 1 comment

Comments

@crayxt
Copy link

commented Aug 19, 2019

Cross-post from pythonnet/pythonnet#941

Dup of my SO question https://stackoverflow.com/questions/57493309/cythonized-python-net-code-cannot-find-system-assemblies

When I compile the python code which uses python.net to access .Net assemblies, it can't find those assemblies. Without compilation it works ok.

For demo code, I used https://github.com/pythonnet/pythonnet/blob/master/demo/helloform.py

My setup.py file

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

ext_modules = [
    Extension(
        'helloform',
        sources = ['helloform.py'],
        language = 'c++'
      )
]

setup(
  name = 'helloform',
  ext_modules = cythonize(ext_modules),
)

Then I build it with python setup.py build_ext --inplace.

I wanted to load compiled module from Python prompt with import helloform but it failed with

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "helloform.py", line 8, in init helloform
ModuleNotFoundError: No module named 'System'
@scoder

This comment has been minimized.

Copy link
Contributor

commented Aug 19, 2019

This is dotnet specific code, using dotnet specific packages. What Python runtime do you use? Please ask over there what the problem might be. It's more likely that they would be able to resolve this than Cython.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.