After the installation of motionless library, I try to run my code and the following error message occurs.
**Traceback (most recent call last):
File "C:\Users\Kevin\Downloads\tracker.py", line 4, in <module>
from motionless import CenterMap
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 2164, in _find_spec
File "<frozen importlib._bootstrap>", line 1940, in find_spec
File "<frozen importlib._bootstrap>", line 1916, in _get_spec
File "<frozen importlib._bootstrap>", line 1897, in _legacy_get_spec
File "<frozen importlib._bootstrap>", line 863, in spec_from_loader
File "<frozen importlib._bootstrap>", line 904, in spec_from_file_location
File "C:\Python34\lib\site-packages\motionless-1.1-py3.4.egg\motionless.py",
line 55
if label and (len(label) <> 1 or not label in Marker.LABELS):
^
SyntaxError: invalid syntax**
Motionless hasn't been updated since 06/08/2010 according to the PyPi Package Index.
I've downloaded it and get the same error immediately just by running:
import motionless
print(motionless.__version__)
It's also not flagged as being Python 3.4 compatible in PyPi; if you are running the latest version of Python this is likely the issue. Have you tried running it with Python 2.7 instead?
Edit: Looking at the Python 2.7 docs; it states here that != and <> are equvilent, however <> is deprecated. In the Python 3.4 docs it states here that only != is supported, no mention of <> so I imagine it's been removed.
You could try instead:
Raising an issue on the GitHub Repo; the author may still be updating the library and not know it's incompatible with Python 3.4
Checking out the code yourself from the GitHub Repo and manually fixing the problem (Check out 2to3 for automatically doing this. It will convert all <> usage to != for you)
Related
I tried to follow the instructions at this page to build a custom Julia system image, in order to speed up the initialization phase when using PyJulia.
The command python3 -m julia.sysimage sys.so successfully builds a sys.so image, but then jl = Julia(sysimage="sys.so") seems to fail, since I still get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "/home/jar/.local/lib/python3.7/site-packages/julia/core.py", line 248, in load_module
elif self.julia.isafunction(juliapath):
File "/home/jar/.local/lib/python3.7/site-packages/julia/core.py", line 239, in julia
self.__class__.julia = julia = Julia()
File "/home/jar/.local/lib/python3.7/site-packages/julia/core.py", line 483, in __init__
raise UnsupportedPythonError(jlinfo)
julia.core.UnsupportedPythonError: It seems your Julia and PyJulia setup are not supported.
Julia executable:
julia
Python interpreter and libpython used by PyCall.jl:
/usr/bin/python3
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
Python interpreter used to import PyJulia and its libpython.
/usr/bin/python3.7
None
Your Python interpreter "/usr/bin/python3.7"
is statically linked to libpython. Currently, PyJulia does not fully
support such Python interpreter.
which is the same issue I am trying to solve by compiling this custom image in the first place.
What am I doing wrong? I would like to avoid the Julia(compiled_modules=False) workaround, because it takes literally forever.
It seems related to this issue, and the following workaround to load the custom image seems to work:
from julia.api import LibJulia
api = LibJulia.load()
api.sysimage = "PATH/TO/CUSTOM/sys.so"
api.init_julia()
from julia import Main
I'm trying to compile a python project including numpy and pandas with nuitka but no matter how I compile it, I have an error when launching the final executable.
For compilation I use the next command :
python -m nuitka --standalone --follow-imports --plugin-enable=numpy --include-plugin-directory=.venv/lib/python3.6/site-packages/pandas --include-plugin-directory=.venv/lib/python3.6/site-packages/numpy --show-progress --show-scons newick2phylipmatrix.py
But when I try to launch the executable generated by the compilation I get the following message :
Traceback (most recent call last):
File "/home/mindsound/sandbox/distMatrix/newick2phylipmatrix.dist/newick2phylipmatrix.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/mindsound/sandbox/distMatrix/newick2phylipmatrix.dist/pandas/__init__.py", line 22, in <module pandas>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/mindsound/sandbox/distMatrix/newick2phylipmatrix.dist/pandas/compat/numpy/__init__.py", line 3, in <module pandas.compat.numpy>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/mindsound/sandbox/distMatrix/newick2phylipmatrix.dist/distutils/__init__.py", line 11, in <module>
AttributeError: module 'opcode' has no attribute '__file__'
Currently without changing anything to the code, I manage to create a standalone with pyinstaller but I can't do it with nuitka but if it's possible I would like to use it to benefit from compilation optimization.
Do you have any idea where this problem comes from and whether it can be solved ?
Well i finally got the solution for the same. The distutils created / copied by the virtualenv while creation is different from the one in the pythons original distribution. One of the teammember at Nuitka helped me discover the same and helped me reach the solution. Well the option i discovered was to pick up the distutils from the Pythons lib folder and replace the existing distutils folder in the virtualenv folder created and the go ahead - compile the same. I believe strongly that the issue will go away for you too as it have gone away for mine. Now will be looking to get in the proper solution for my complete project work.
Happy Compilation :)
I have a python function that I've created as an Azure App Function. It works on my local machine fine, however fails with no descriptive error when executed after a successful publishing.
Originally, it failed with 500 internal server error due to:
Result: Failure
Exception: ModuleNotFoundError: No module named 'pandas'
Stack: File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/azure/functions_worker/dispatcher.py", line 218, in _handle__function_load_request
func_request.metadata.entry_point)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/azure/functions_worker/loader.py", line 66, in load_function
mod = importlib.import_module(fullmodname)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/site/wwwroot/generateGraph/__init__.py", line 2, in <module>
import pandas as pd
I thought this was me not publishing with the --build-native-deps switch. So I republished with this switch: (.env) C:\Temp\python_function>func azure functionapp publish httpGenGraph --build-native-deps
And publishing was successful. Now, when I execute the Http Trigger, I get the same error again. Is there something I'm missing? I'm new to Python so it could be not understanding the packaging requirements or something. The function does work within my local virtual python environment.
Figured it out. I needed to pipe the output of pip freeze to the requirements.txt file. This allowed the packages to be properly referenced when publishing.
For reference:
(.env) C:\Temp\python_function>pip freeze > requirements.txt
Then:
(.env) C:\Temp\python_function>func azure functionapp publish httpGenGraph --build-native-deps
I am on Windows 7 with python 3.5.4 and Pycharm Community Edition 2017.2
When I execute my python script in the cmd.exe it works fine. But when using the Run or Debug tools in Pycharm I get this error:
Traceback (most recent call last):
File "C:\Users\xy\my_project\env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\xy\AppData\Local\Continuum\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
Now I am familiar with this specific error. Usually this occures if Microsoft Visual C++ Redistributable (or Visual Studio) is not installed. But this is not the case since I have installed the Microsoft Visual C++ 2015 Redistributable Update 3 (that's why the python script is working on the console).
My guess is, that I have to add some Path to Pycharm? But I do not know where or which one.
This is how I resolved the issue:
Open cmd.exe -> Create virtual env -> start Pycharm (pycharm.bat) from there
I installed "plugged in" Python as a plug in into Netbeans using from here. I was using Eclipse, and even though it was a little wonky, it could at least find Pyserial. Now, when I try to run a project (which worked fine in Eclipse), I get the following error:
Traceback (most recent call last):
File "G:\Prog\PythonCurrent\RadioDB\src\radiodb.py", line 8, in <module>
import serial
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\__init__.py", line 19, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\serialwin32.py", line 12, in <module>
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 2164, in _find_spec
File "<frozen importlib._bootstrap>", line 1940, in find_spec
File "<frozen importlib._bootstrap>", line 1916, in _get_spec
File "<frozen importlib._bootstrap>", line 1897, in _legacy_get_spec
File "<frozen importlib._bootstrap>", line 863, in spec_from_loader
File "<frozen importlib._bootstrap>", line 904, in spec_from_file_location
File "c:\Python34\lib\site-packages\pyserial-2.7-py3.4-win32.egg\serial\win32.py", line 196
MAXDWORD = 4294967295L # Variable c_uint
^
SyntaxError: invalid syntax
I don't understand why. My python34\Lib directory contains searial's stuff, and in python34\Lib\site-packages I have the same folder in addition to pyserial's egg and egg-info files. Do I need to specify where these are in Netbeans or copy some folders to Netbeans?
SOLUTION:
Thanks #Padraic Cunningham
I just like to make sure that the solution is clear for anyone because I have been lost before (like anyone at first).
Sooo, the solution is use pip3 install pyserial to install for python3...
I like to make cmd doskey macros, so I'll probably do that, but the easiest thing to install something with "pip3" is go to cmd.exe/terminal and then go to python home directory, then cd to scripts; type pip3.exe install pyserial or whatever you are installing (you can use pip3.4.exe... if you have it) and voila... easiest thing in the world if you know about it.
#PadraicCunningham
use pip3 install pyserial to install almost major packages.
Pyserial isn't updated to Python 3 yet, it only works in Python 2. So change your interpreter to Python 2.7.