ImportError: DLL load failed: Invalid access to memory locat

Hello

As the title suggests, I have run into this error while trying to compile Panda3D on my machine. I have googled that error extensively but it seems to be very vague with many different causes and solutions. I suspect core.pyd to be the issue but I’m not entirely sure how. I have followed the instructions presented in these forums on two machines with identical results. Both machines are running windows 7 and I have installed x64 versions of python 3.4 and the thirdparty tools on both. I am aware of the problems the latest build has with python 3 so I used several different builds prior to that one, going back as far as march, all of which failed at the same point. Below is what I entered in to the command prompt and it’s output. This is after an already failed attempt so it skips straight to the point of failure.

D:\Temp\panda>makepanda\makepanda.bat --everything --installer
WARNING: Could not locate pkg-config package eigen3, excluding from build
WARNING: Could not locate thirdparty package fftw, excluding from build
WARNING: Could not locate thirdparty package opencv, excluding from build
WARNING: Could not locate thirdparty package awesomium, excluding from build
WARNING: Could not locate thirdparty package rocket, excluding from build
WARNING: Could not locate thirdparty package wx, excluding from build
WARNING: Could not locate thirdparty package wx, excluding from build
WARNING: Could not locate thirdparty package fltk, excluding from build
RefactoringTool: Refactored built_x64/direct\ffi\panda3d.py
RefactoringTool: Files that were modified:
RefactoringTool: built_x64/direct\ffi\panda3d.py
Generating dependencies...
[ 92%] Generating 'pandac' tree
Traceback (most recent call last):
  File "built_x64\direct\ffi\jGenPyCode.py", line 74, in <module>
    from direct.ffi import DoGenPyCode
  File "D:\Temp\panda\built_x64\direct\ffi\DoGenPyCode.py", line 11, in <module>
    from direct.ffi import FFIConstants
  File "D:\Temp\panda\built_x64\direct\ffi\FFIConstants.py", line 3, in <module>
    from direct.directnotify.DirectNotifyGlobal import *
  File "D:\Temp\panda\built_x64\direct\directnotify\DirectNotifyGlobal.py", line
 3, in <module>
    from . import DirectNotify
  File "D:\Temp\panda\built_x64\direct\directnotify\DirectNotify.py", line 5, in
 <module>
    from . import Notifier
  File "D:\Temp\panda\built_x64\direct\directnotify\Notifier.py", line 6, in <mo
dule>
    from direct.showbase import PythonUtil
  File "D:\Temp\panda\built_x64\direct\showbase\PythonUtil.py", line 64, in <mod
ule>
    from panda3d.core import ConfigVariableBool
ImportError: DLL load failed: Invalid access to memory location.
Storing dependency cache.
Elapsed Time: 26 sec
The following command returned a non-zero value: D:\Temp\panda\thirdparty\win-py
thon-x64\python.exe -B built_x64\direct\ffi\jGenPyCode.py -r panda3d.core panda3
d.physics panda3d.fx panda3d.direct panda3d.vision panda3d.skel panda3d.egg pand
a3d.ode panda3d.vrpn
Build terminated.

D:\Temp\panda>

This problem has been driving me nuts, any further information you need I’m more than happy to provide. Any help or advice would be greatly appreciated.

Thank you.

Sorry, I’m equally stuck on this. It seems to happen every time I build with the (extremely experimental) Python 3 support on Windows, and I haven’t been able to figure anything out about it yet.

Well I can confirm that the problem is definitely Python 3 and Windows as that’s what my project is aimed at. My research has led me to believe it’s something to do with the way the core module is compiled into a .pyd. I’ve tried making sure there is only one version of msvcr100.dll on my machine. I’ve tried on different machines with the same result. My project has basically come to a halt at this point. There are other areas I can work on though. Do you have a rough estimate of when you can give it a look? Or even some direction I could head in?

Thank you for all your hard work on this project and helping with our problems. I certainly appreciate it.

I don’t have time for it in the short term, sorry, I’m all tied up with other tasks.

You could try recompiling Python using the Python source code; that’s the next thing I would have tried myself.

Thanks, I did think of that but was too frustrated to try it at the time. I will update this thread with any progress I make.

So I’ve (finally) compiled python from source and it still fails at the same point with the same error message. I’m putting this to rest for now but I’ll keep an eye on the commits in case you get around to it.

I’ve got it!

The issue was that Python is compiled in Unicode mode, and Panda3D is not, and Panda3D makes use of some some global ASCII strings (__argv) defined in the MSVCRT that aren’t ever made available when the executable is run with the Unicode entry point. I’ve checked in some fixes to make Panda3D no longer rely on those variables.

I can now run the sample programs on Windows with my Python 3 build. :slight_smile:

Brilliant! Thank you so much. I’m going to have a little party in your honor. Ok, maybe not a party but a sip of wine at least.

Haha, I like your sense of humor. :laughing:

Not sure if this is the appropriate place to be putting this but it leads on from the conversation already in this thread. I got it compiled and installed then followed the Panda Hello World tute at the start of the manual. At every stage it ran into python 2 to 3 compatibility errors. Print statements that should be print functions, imports that were relative but weren’t stated as such as well as a few explicitly declared long ints. I’ve fixed them and finished the tute but I thought you should know about this. I tried running 2to3 over them but it didn’t seem to fix them. Not surprising since it seems the builder does the same thing anyway. There were a lot of errors, invalid input I think.

Anyway, it’s a minor hassle and it’s in a state where I can continue forward. Thanks again for your hard work.

Yes, makepanda runs 2to3 on the entirety of the “direct” tree, but it doesn’t make an attempt to convert the sample programs. This has to be done manually.