Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unable to import crl with python 3.10 - 32bit #1617

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

Closed
riz-hossain opened this issue Nov 17, 2021 · 13 comments
Closed

Unable to import crl with python 3.10 - 32bit #1617

riz-hossain opened this issue Nov 17, 2021 · 13 comments

Comments

@riz-hossain
Copy link

riz-hossain commented Nov 17, 2021

Environment

Pythonnet Version:
Requirement already satisfied: pythonnet in c:\users\hossa\appdata\local\programs\python\python310-32\lib\site-packages\pythonnet-3.0.0.dev1-py3.10.egg (3.0.0.dev1)
Requirement already satisfied: clr_loader in c:\users\hossa\appdata\local\programs\python\python310-32\lib\site-packages\clr_loader-0.1.6-py3.10.egg (from pythonnet) (0.1.6)
Requirement already satisfied: cffi>=1.13 in c:\users\hossa\appdata\local\programs\python\python310-32\lib\site-packages (from clr_loader->pythonnet) (1.15.0)
Requirement already satisfied: pycparser in c:\users\hossa\appdata\local\programs\python\python310-32\lib\site-packages (from cffi>=1.13->clr_loader->pythonnet) (2.21)

  • Python version:3.10.0
  • Operating System: windows 10
  • .NET Runtime:

v2.0.50727 2.0.50727.4927
v3.0 3.0.30729.4926
Windows Communication Foundation 3.0.4506.4926
Windows Presentation Foundation 3.0.6920.4902
v3.5 3.5.30729.4926
Client 4.8.04084
Full 4.8.04084
Client 4.0.0.0

Details

import clr
gives the following error:

Traceback (most recent call last):
  File "C:\Users\hossa\git\Research\Riz\clrstuff.py", line 1, in <module>
    import clr
  File "C:\Users\hossa\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pythonnet-3.0.0.dev1-py3.10.egg\clr.py", line 6, in <module>
    load()
  File "C:\Users\hossa\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pythonnet-3.0.0.dev1-py3.10.egg\pythonnet\__init__.py", line 43, in load
    if func(''.encode("utf8")) != 0:
  File "C:\Users\hossa\AppData\Local\Programs\Python\Python310-32\lib\site-packages\clr_loader-0.1.6-py3.10.egg\clr_loader\wrappers.py", line 20, in __call__
    return self._callable(ffi.cast("void*", buf_arr), len(buf_arr))
RuntimeError: cannot call null pointer pointer from cdata 'int(*)(void *, int)'

@CommonCrisis
Copy link

If you read the docs you can see that pythonnet is only working for <=Python3.8.

#1389

@filmor
Copy link
Member

filmor commented Nov 22, 2021

Well, the master branch (that the pythonnet-3.0 is built from) should support 3.9 and 3.10, but I can't reproduce this particular error.

@riz-hossain
Copy link
Author

riz-hossain commented Nov 22, 2021 via email

@filmor
Copy link
Member

filmor commented Nov 22, 2021

It could matter in the sense that I don't have a 32bit system to test with, so I can just test a 64bit Windows with a 32bit Python installation, and that doesn't exhibit the problem that you are seeing.

@filmor
Copy link
Member

filmor commented Dec 22, 2021

It could be that this was fixed in pythonnet/clr-loader#15, so clr-loader 0.1.7. Please try to upgrade this package (pip install -U clr-loader) and reopen if that doesn't fix the issue.

@mohammadjavadqazi
Copy link

Still has same problem 32bit Windows 10
Python 3.10.0
Clr_loader 0.1.7

@mohammadjavadqazi
Copy link

update .NET and solved.

@Yuangang0101
Copy link

update .NET and solved.

could you pls share you address this issue with more details,
i still have this issue and pending my development for days..
File "C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\site-packages\pythonnet\__init__.py", line 143, in load if func(b"") != 0: File "C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\site-packages\clr_loader\types.py", line 64, in __call__ return self._callable(ffi.cast("void*", buf_arr), len(buf_arr)) RuntimeError: cannot call null pointer pointer from cdata 'int(*)(void *, int)'

@tony950309
Copy link

Hi, did you solve the problem?
I am using :
python 3.7.11
windows 10 64bits
Clr_loader 0.1.7

everything is okay while running in pycharm, but after I pack up the script in pyinstaller, I got the error:

cannot load library ...\clr_loader\ffi\dlls\amd64\ClrLoader.dll': error 0x7e

after I copy the clr_loader folder to the project folder, I got the same error :

File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "clr.py", line 6, in
File "pythonnet_init
.py", line 143, in load
File "clr_loader\types.py", line 64, in call
return self._callable(ffi.cast("void*", buf_arr), len(buf_arr))
RuntimeError: cannot call null pointer pointer from cdata 'int(*)(void *, int)'

@stansotn
Copy link

stansotn commented Apr 27, 2023

I am seeing this issue with pyinstaller on python3.9; @tony950309 were you able to find a workaround?

@Josef-Haupt
Copy link

I also get the same error after building with pyinstaller:
clr-loader 0.2.5
pythonnet 3.0.1
python 3.10.10

I have no idea what the problem is, since it works on my win11 machine, but won't on another and I did not install any additional .NET dependencies.

Is there a workaround? Or do you need more info? I see this issue is closed, but seems to be an ongoing problem.

@x011
Copy link

x011 commented May 25, 2023

The problem seems to be related to an outdated hook-clr.py from pyinstaller-hooks-contrib, updating pyinstaller-hooks-contrib solved my problem.

pip install --upgrade --force-reinstall pyinstaller-hooks-contrib

@daogework
Copy link

I faced this problem in venv,without venv no problem,and nothing to do with py310 or py311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants