Skip to content

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

Closed

Description

@riz-hossain

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)'

Activity

  1. CommonCrisis commented on Nov 22, 2021

    @CommonCrisis

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

    #1389

  2. filmor commented on Nov 22, 2021

    @filmor
    Member

    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.

  3. riz-hossain commented on Nov 22, 2021

    @riz-hossain
    Author
  4. filmor commented on Nov 22, 2021

    @filmor
    Member

    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.

  5. filmor commented on Dec 22, 2021

    @filmor
    Member

    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.

  6. mohammadjavadqazi commented on Apr 19, 2022

    @mohammadjavadqazi

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

  7. mohammadjavadqazi commented on Apr 25, 2022

    @mohammadjavadqazi

    update .NET and solved.

  8. Yuangang0101 commented on Oct 18, 2022

    @Yuangang0101

    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)'

  9. tony950309 commented on Jan 16, 2023

    @tony950309

    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)'

  10. stansotn commented on Apr 27, 2023

    @stansotn

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

  11. Josef-Haupt commented on May 24, 2023

    @Josef-Haupt

    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.

  12. x011 commented on May 25, 2023

    @x011

    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

  13. daogework commented on May 30, 2023

    @daogework

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions