Running Panda3D on Python 2.6 - python

I just got Panda3D for the first time. I deleted the included Python version. In my Python dir, I put a file panda.pth that looks like this:
C:\Panda3D-1.6.2
C:\Panda3D-1.6.2\bin
But when I run import direct.directbase.DirectStart, I get:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import direct.directbase.DirectStart
File "C:\Panda3D-1.6.2\direct\directbase\DirectStart.py", line 3, in <module>
from direct.showbase import ShowBase
File "C:\Panda3D-1.6.2\direct\showbase\ShowBase.py", line 10, in <module>
from pandac.PandaModules import *
File "C:\Panda3D-1.6.2\pandac\PandaModules.py", line 1, in <module>
from libpandaexpressModules import *
File "C:\Panda3D-1.6.2\pandac\libpandaexpressModules.py", line 1, in <module>
from extension_native_helpers import *
File "C:\Panda3D-1.6.2\pandac\extension_native_helpers.py", line 75, in <module>
Dtool_PreloadDLL("libpandaexpress")
File "C:\Panda3D-1.6.2\pandac\extension_native_helpers.py", line 73, in Dtool_PreloadDLL
imp.load_dynamic(module, pathname)
ImportError: Module use of python25.dll conflicts with this version of Python.
I'm assuming this has something to do with me using Python 2.6. Any solutions?

Python extensions aren't binary compatible across major releases. Your options are:
A. Recompile panda3d for python 2.6.
B. Use python 2.5.
No way around it.

If you can wait for the upcoming 1.7.0 release, it will be compiled against Python 2.6 - see this thread.

Related

PyGears - Can't run script, PYPY is undefined

I am trying to setup PyGears, I have installed the package using pip. I am trying to execute the bellow two lines of code using command line.
from pygears import gear, Intf
from pygears.typing import Uint
This is the error I received:
Traceback (most recent call last):
File "test.py", line 1, in <module>
from pygears import gear, Intf
File "C:\Users\Nikola\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pygears\__init__.py", line 15, in <module>
import pygears.typing
File "C:\Users\Nikola\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pygears\typing\__init__.py", line 1, in <module>
from pygears.conf import PluginBase, reg
File "C:\Users\Nikola\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pygears\conf\__init__.py", line 5, in <module>
from .trace import pygears_excepthook, register_issue, MultiAlternativeError
File "C:\Users\Nikola\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pygears\conf\trace.py", line 400, in <module>
elif PYPY:
NameError: name 'PYPY' is not defined
To my understanding, PyPy is an alternative interpreter to CPython, but I am unsure whether the symbol mentioned above is related to this. Should I try configuring PyPy as my interpreter or is this issue caused by something else?
Thank you in advance
Update: this has been fixed by https://github.com/bogdanvuk/pygears/commit/a27df7ce62cfe568978fad1f39d87372b5b9a531
This looks like a bug in pygears. If you try with python >= 3.7, you should not run into this error.
I submitted a bug report: https://github.com/bogdanvuk/pygears/issues/8

C++ - Python Embedding with numpy

I would like to call a python function from C++ and get the return value. I've been able to do that with an easy multiply python function using this website's example code in section 5.3. To compile my program, I would run g++ test.cpp -I/usr/include/python2.7 -lpython2.7. However, the python function I want to run imports numpy. When I try to run my program that is similar to the one on the code example mentioned above, I get an "ImportError: cannot import name _remove_dead_weakref". The full error is here:
Traceback (most recent call last):
File "/home/osboxes/Desktop/test.py", line 1, in <module>
import numpy as np
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/core/__init__.py", line 74, in <module>
from numpy.testing.nosetester import _numpy_tester
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/testing/__init__.py", line 10, in <module>
from unittest import TestCase
File "/home/osboxes/miniconda2/lib/python2.7/unittest/__init__.py", line 64, in <module>
from .main import TestProgram, main
File "/home/osboxes/miniconda2/lib/python2.7/unittest/main.py", line 7, in <module>
from . import loader, runner
File "/home/osboxes/miniconda2/lib/python2.7/unittest/runner.py", line 7, in <module>
from .signals import registerResult
File "/home/osboxes/miniconda2/lib/python2.7/unittest/signals.py", line 2, in <module>
import weakref
File "/home/osboxes/miniconda2/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Some information: Python version is Python 2.7.14 :: Anaconda, Inc. (Is there a difference between python 2.7.14 and my version which has anaconda, inc. at the end?) The python program also runs just fine by itself. Any help would be appreciated. Thanks!
Edit: The path was being all weird with some parts going to my local python and numpy going to miniconda's python. Uninstalling miniconda as it wasn't needed for me fixed it.
This is happening because your environment is mixing two different Python installations. You can see it jump between them here:
File "/home/osboxes/.local/lib/python2.7/site-packages/numpy/testing/__init__.py"
File "/home/osboxes/miniconda2/lib/python2.7/unittest/__init__.py"
So you start out in /home/osboxes/.local/lib/python2.7/site-packages which is the Python installed by some system package manager (or perhaps even explicitly installed from source). But then it jumps to /home/osboxes/miniconda2/lib/python2.7 which is from Conda.
Since it appears you are intending to use Python from Conda, you need to install NumPy using Conda (so it is loaded from miniconda2 and not .local, and build your code using something like -I/home/osboxes/miniconda2/include/python2.7 instead of -I/usr/include/python2.7.

Python embedding, ImportError: cannot import name _remove_dead_weakref

I am trying to run some C++ code with embedded Python. Code was working completely fine a couple of weeks ago. The code still compiles, but I am now getting the error
Traceback (most recent call last):
File "./main.py", line 1, in <module>
import numpy as np
File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/site-packages/numpy/core/__init__.py", line 74, in <module>
from numpy.testing.nosetester import _numpy_tester
File "/usr/local/lib/python2.7/site-packages/numpy/testing/__init__.py", line 10, in <module>
from unittest import TestCase
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/__init__.py", line 64, in <module>
from .main import TestProgram, main
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 7, in <module>
from . import loader, runner
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/runner.py", line 7, in <module>
from .signals import registerResult
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/signals.py", line 2, in <module>
import weakref
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Since then the only change I have made is to install the macOS Supplemental Update and to upgrade Python from 2.7.13_1 to 2.7.14_2 (using Homebrew). I have changed the relevant linker flags in the makefile, i.e. those that appear when I type python-config --ldflags. I have also made sure that the Python I am using is definitely the Homebrew one by inserting export PATH="/usr/local/opt/python/libexec/bin:$PATH" into my .bash_profile as directed by Homebrew.
I am not sure whether this error is because of the Python update, the recent macOS Supplemental Update, or something else. Any idea what the problem could be?
Thanks
I had the same problem;
In python 2.7 the NumPy 1.8.0 was available,
Then I installed NumPy (again) using brew, and it wasn't available in my python (2.7) anymore. (Got the same error you got here)
So I did "brew unlink python && brew link python" to use python 3 (instead of 2) which NumPy 1.14 is available in it.
I guess the python 2.7 was not compatible with this recent version of NumPy.

Starting Sikuli from Python returns error

I want to run Sikuli for automating windows application using Python. I am new to Sikuli. Actually I have installed Sikuli by using pip install sikuli. And then I tried to import it in my Python file as given below:
from sikuli import *
print("Working")
but when i run it using 'python sikuliTest.py', I get the following error as given below:
Traceback (most recent call last):
File "sikuliTest.py", line 1, in <module>
from sikuli import *
File "c:\Python27\lib\site-packages\sikuli-0.1-py2.7- win32.egg\sikuli\__init__
.py", line 1, in <module>
from sikuli import *
File "c:\Python27\lib\site-packages\sikuli-0.1-py2.7- win32.egg\sikuli\sikuli.p
y", line 15, in <module>
from jnius import autoclass
File "d:\users\deepak-ra\appdata\local\temp\easy_install-4xytd2\jnius- 1.1.dev0
-py2.7-win32.egg.tmp\jnius\__init__.py", line 12, in <module>
File "d:\users\deepak-ra\appdata\local\temp\easy_install-4xytd2\jnius- 1.1.dev0
-py2.7-win32.egg.tmp\jnius\jnius.py", line 7, in <module>
File "d:\users\deepak-ra\appdata\local\temp\easy_install-4xytd2\jnius-1.1.dev0
-py2.7-win32.egg.tmp\jnius\jnius.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
Am not sure whether I had installed it correctly or where I have done the mistake. Please help me out with this.
Sikuli is using Jython and cannot be run directly from Python. If you want to use Python syntax to create scripts using Sikuli start reading here. Have a look at section 3 "How do I set up SikuliX".
For any specific questions/issues use the Sikuli Launchpad.

Trouble importing numba

Ok, I'm using python 3.3. I have numpy, llvm, llvmpy, llpyhton, llvm_array, llvm_cbuilder and llvmath installed. I have also installed numba.
However, when trying to import via import numba, the following error appears. I have no idea of what could be missing:
Traceback (most recent call last):
File "/home/pablo/workspace/Pruebas/src/Prueba2/__init__.py", line 1, in <module>
import numba
File "/usr/local/lib/python3.3/dist-packages/numba/__init__.py", line 18, in <module>
from numba import utils, typesystem
File "/usr/local/lib/python3.3/dist-packages/numba/utils.py", line 102, in <module>
context = get_minivect_context()
File "/usr/local/lib/python3.3/dist-packages/numba/utils.py", line 100, in get_minivect_context
return NumbaContext()
File "/usr/local/lib/python3.3/dist-packages/numba/minivect/miniast.py", line 138, in __init__
import llvm.core as llvm_py_not_available # llvm-py not available
File "/usr/local/lib/python3.3/dist-packages/llvm/__init__.py", line 6, in <module>
from llvmpy import extra
File "/usr/local/lib/python3.3/dist-packages/llvmpy/extra.py", line 6, in <module>
from llvmpy import _api
ImportError: libLLVM-3.2.so: cannot open shared object file: No such file or directory
Any ideas?
Ok, I found out what was wrong.
I added the anaconda folders to the deafault python3 interpreter, instead of installing numba directly in the packages folder.

Categories

Resources