[joepareti54#xxx build]$ ./manta ../scenes/_trainingData.py --dim 3 --addModelGeometry True --addSphereGeometry True
Version: mantaflow 64bit fp1 commit dd3bb0c0a65cc531d3c33487bde5edcb4aa6784f from Mar 14 2018, 14:53:44
Loading script '../scenes/_trainingData.py'
Traceback (most recent call last):
File "../scenes/_trainingData.py", line 12, in <module>
from Emitter import *
File "/home/joepareti54/FluidNet/manta/scenes/Emitter.py", line 15, in <module>
import matlabnoise
File "/home/joepareti54/FluidNet/manta/build/../../../matlabnoise/matlabnoise.py", line 81
def Perlin2D(*args) -> "double" :
^
SyntaxError: invalid syntax
I believe the invalid syntax occurs in:
def Perlin2D(*args) -> "double" :`enter code here`
return _matlabnoise.Perlin2D(*args)
Perlin2D = _matlabnoise.Perlin2D
Your problem is that mantaflow is running an embedded Python, so the version used is the one that was available when mantaflow was compiled and it appears that version does not support the type annotations introduced in Python 3.5
When you run which python that shows you the version of Python installed on your system, not the version compiled into the other program.
Solutions include recompiling mantaflow with a more recent Python, or stop using type annotations.
Related
I am trying to import the following library:
import json2xml
from json2xml.utils import readfromstring
However, when I execute the second line I get this error:
Traceback (most recent call last):
File "C:\Users\denis\Desktop\Pazaruvaj Upload\Pazaruvaj_Part1_Test.py", line 12, in <module>
from json2xml.utils import readfromurl, readfromstring, readfromjson
File "C:\Python27\lib\site-packages\json2xml\utils.py", line 19
def readfromjson(filename: str) -> dict:
^
SyntaxError: invalid syntax
Couldn't find anything online about this issue.
Note I don't write from json2xml import json2xml because it gives the same error
According to https://pypi.org/project/json2xml/, json2xml is not compatible with Python2.
Python2 is deprecated, please update to Python3. Then this library should work.
I am using the PyYAML-3.10 as part of a Python program on macOS 10, using Python version 2.7.10. I am not able to make sense of these compilation errors. Since PyYAML-3.10 is a stable version of PyYAML, it should give no compilation errors. The errors are listed below. Any suggestions would be appreciated.
File "pyR#TE.py", line 3, in <module>
import yaml
File "/Users/PyR#TE/pyrate-1.0.0/yaml/__init__.py", line 8, in <module>
from .loader import *
File "/Users/PyR#TE/pyrate-1.0.0/yaml/loader.py", line 4, in <module>
from .reader import *
File "/Users/PyR#TE/pyrate-1.0.0/yaml/reader.py", line 45, in <module>
class Reader(object):
File "/Users/PyR#TE/pyrate-1.0.0/yaml/reader.py", line 137, in Reader
NON_PRINTABLE = re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]')
raise error, v # invalid expression
sre_constants.error: bad character range
It seems that PyYAMP-3.10 is not compatible with Python 2. (Did you mean "PyYAML", by the way? I could not find a reference to a "PyYAMP" package anywhere.) The compilation error you are seeing is from re.compile - when Python is trying to compile a regular expression.
I tried using the line in your error message containing re.compile in Python 2 and Python 3.
Python 2:
>>> import re
>>> re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/re.py", line 194, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.7/re.py", line 251, in _compile
raise error, v # invalid expression
sre_constants.error: bad character range
>>>
Python 3:
>>> import re
>>> re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]')
re.compile('[^\t\n\r -~\x85\xa0-\ud7ff\ue000-�]')
>>>
So your options are either to find a package that supports Python 2, or to upgrade your code to Python 3. I recommend upgrading, as Python 2 is no longer supported.
I have been looking for ways to convert a custom trained yolov3-tiny network from darknet format to Caffe format, but every Python program I tried has failed. Has someone managed to do it and make it work? If so, what program or tutorial did you use and under which environment?
I have a machine with windows 10 and Visual Studio 2019 installed, and also a virtual machine with Ubuntu 18.04, in case that's any helpful.
Edit: these are some of the programs I've tried:
https://github.com/marvis/pytorch-caffe-darknet-convert
~/darknet2caffe/pytorch-caffe-darknet-convert-master$ python darknet2caffe.py ../yolov3-conos-tiny.cfg ../yolov3-conos-tiny.weights conos.prototxt conos.caffemodel
unknow layer type yolo
unknow layer type upsample
Traceback (most recent call last):
File "darknet2caffe.py", line 350, in <module>
darknet2caffe(cfgfile, weightfile, protofile, caffemodel)
File "darknet2caffe.py", line 10, in darknet2caffe
net_info = cfg2prototxt(cfgfile)
File "darknet2caffe.py", line 251, in cfg2prototxt
prev_layer_id = layer_id + int(block['layers'])
ValueError: invalid literal for int() with base 10: '-1, 8'
https://github.com/BingzheWu/object_detetction_tools
~/darknet2caffe/object_detetction_tools-master/nn_model_transform$ python darknet2caffe.py ../../yolov3-conos-tiny.cfg ../../yolov3-conos-tiny.weights conos.prototxt conos.caffemodel
Traceback (most recent call last):
File "darknet2caffe.py", line 6, in <module>
from prototxt_utils import *
File "/home/carlos/darknet2caffe/object_detetction_tools-master/nn_model_transform/prototxt_utils.py", line 151
print('%s%s {' % (blanks, prefix), end = "\n", file = fp)
^
SyntaxError: invalid syntax
https://github.com/eric612/MobileNet-YOLO/tree/master/models/darknet_yolov3
~/darknet2caffe/MobileNet-YOLO-master/models/darknet_yolov3$ python darknet2caffe.py ../../../yolov3-conos-tiny.cfg ../../../yolov3-conos-tiny.weights conos.prototxt conos.caffemodel
2
OrderedDict([('bottom', 'layer19-conv'), ('top', 'layer20-upsample'), ('name', 'layer20-upsample'), ('type', 'Upsample'), ('upsample_param', OrderedDict([('scale', '2')]))])
('upsample:', 20)
[libprotobuf ERROR google/protobuf/text_format.cc:298] Error parsing text-format caffe.NetParameter: 636:20: Message type "caffe.LayerParameter" has no field named "upsample_param".
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0518 13:14:19.206104 15199 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: conos.prototxt
*** Check failure stack trace: ***
Aborted (core dumped)
I am using Python 2.7 and have Caffe and Pytorch installed. I compiled the caffe library following this tutorial: https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide
I'm unable to import the timezonefinder Python library:
>>> import timezonefinder
Traceback (most recent call last):
File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/timezonefinder/__init__.py", line 2, in <module>
from .timezonefinder import TimezoneFinder File "/usr/local/lib/python2.7/dist-packages/timezonefinder/timezonefinder.py", line 300
def closest_timezone_at(self, *, lat, lng, delta_degree=1, exact_computation=False, return_distances=False,
^ SyntaxError: invalid syntax
Timezonefinder supports Python 3 only. You're using Python 2.
One immediate piece of evidence is that the syntax def f(a, *, b=xyz) is not valid in Python 2, as shown in your traceback.
You can always check a package's setup.py, which (should) hint at 'Programming Language :: Python :: 3 :: Only' for this limitation.
I'm learning Xpath and XSLT using Python 2.6.6-64bit on my unix workstation. For Xpath, I'm using the xpath module provided in PyXml-0.8.4.
However, the import line itself throws the following error:
Traceback (most recent call last):
File "xp.py", line 7, in <module>
from xml.xpath import Evaluate
File "/usr/local/python-2.6.6-64bit/lib/python2.6/site-packages/_xmlplus/xpath/__init__.py", line 112, in <module>
from pyxpath import ExprParserFactory
File "/usr/local/python-2.6.6-64bit/lib/python2.6/site-packages/_xmlplus/xpath/pyxpath.py", line 59, in <module>
from xml.xpath.ParsedAbbreviatedRelativeLocationPath import ParsedAbbreviatedRelativeLocationPath
File "/usr/local/python-2.6.6-64bit/lib/python2.6/site-packages/_xmlplus/xpath/ParsedAbbreviatedRelativeLocationPath.py", line 31
as = ParsedAxisSpecifier.ParsedAxisSpecifier('descendant-or-self')
^
SyntaxError: invalid syntax
Looking it up led me to understand that this is because 'as' is a reserved name in python-2.6 and PyXML-0.8.4 tries to redefine it. However, there are no directions on how to resolve this issue.
Please advise.
PyXML is obsolete and should not be used (see here). That's why there are no updates for it. Many features that were included in it were added to Python's standard library. There are also fully-supported third-party packages for Python XML processing like lxml.