I am trying to import asammdf to read MDF files but when i excute my script, there is an error from first line " import asammdf"
error is as follows :
Traceback (most recent call last):
File "<pyshell#2>", line 1, in
import asammdf
File "C:\Python\Python35-32\lib\site-packages\asammdf_init_.py", line 15, in
from .blocks.mdf_v2 import MDF2
File "C:\Python\Python35-32\lib\site-packages\asammdf\blocks\mdf_v2.py", line 4, in
from .mdf_v3 import MDF3
File "C:\Python\Python35-32\lib\site-packages\asammdf\blocks\mdf_v3.py", line 455
types.append(("", f"V{gap}"))
^
SyntaxError: invalid syntax
The library is using f-strings (see PEP 498), which were implemented in Python 3.6:
f"V{gap}"
But you are running this in Python 3.5:
File "C:\Python\Python35-32\lib\site-packages\asammdf\blocks\mdf_v3.py", line 455
You should install a newer version of Python. Python 3.5 is not supported any more (it is at end of life - see status of python branches).
Both github repo and the pypi page state that for version 5.x.y of asammdf the minimum python version is 3.6
You probably just copied the package manually to the site-packages folder
Related
I am trying to run a Julia script from python. I have Julia 1.6.4 installed (also tried 1.7.3) and installed pip install julia from Pycharm's terminal in the virtual environment. When importing julia and then running julia.install() I get the following error message:
I use Pycharm with a virtual environment with Python 3.9.7 for my project. However, I have also tried different python versions in different virtual environments or by using the base python installed. All give the same error.
Also, ~/.julia/packages/PyCall/*/deps/build.log does not exist for me.
[ Info: Trying to import PyCall...
Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\site.py", line 73, in <module>
import os
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\os.py", line 29, in <module>
from _collections_abc import _check_methods
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\_collections_abc.py", line 12, in <module>
GenericAlias = type(list[int])
TypeError: 'type' object is not subscriptable
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\<user>\PycharmProjects\<project>\venv\lib\site-packages\julia\tools.py", line 118, in install
raise PyCallInstallError("Installing", output)
julia.tools.PyCallInstallError: Installing PyCall failed.
** Important information from Julia may be printed before Python's Traceback **
Some useful information may also be stored in the build log file
`~/.julia/packages/PyCall/*/deps/build.log`.```
Julia needs to have PyCall installed
PyCall in Julia needs to be configured to use the same Python that you are using to call Julia from
For more information see this post:
I have a high-performant function written in Julia, how can I use it from Python?
While importing openai's universe, i get these errors:
Traceback (most recent call last):
File "/Users/calvin/Desktop/universe-test/main.py", line 2, in <module>
import universe
File "/Users/calvin/universe/universe/__init__.py", line 22, in <module>
from universe import error, envs
File "/Users/calvin/universe/universe/envs/__init__.py", line 1, in <module>
import universe.envs.vnc_env
File "/Users/calvin/universe/universe/envs/vnc_env.py", line 11, in <module>
from universe.envs import diagnostics
File "/Users/calvin/universe/universe/envs/diagnostics.py", line 94
async = self.qr_pool.apply_async(self.method, (self._last_img, time.time(), available_at))
^
SyntaxError: invalid syntax
I've tried downloading a different version of gym, reinstalling universe, and nothing works. I have python 3.8.5 64-bit. My operating system is macOS Catalina 10.15.6. Any ideas?
async is now a special keyword, and as such, can't be used as a variable name.
That library appears to be made for Python pre-3.5. I believe your only options are:
Use a older version of Python 3 (async was intrduced in 3.5).
Edit the local copy of the library file to change the name to something else.
Check to see if there are any updates/forks to the library that fix that issue.
I installed pyAudioAnalysis on python2.7 using pycharm (linux). Trying to run audioBasicIO.py gives the following error. I have installed eyeD3 but it does not work.
/usr/bin/python2.7 /usr/local/lib/python2.7/dist-packages/pyAudioAnalysis/audioBasicIO.py
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pyAudioAnalysis/audioBasicIO.py", line 6, in <module>
import eyed3
File "/home/.local/lib/python2.7/site-packages/eyed3/__init__.py", line 31, in <module>
from .utils.log import log # noqa: E402
File "/home/.local/lib/python2.7/site-packages/eyed3/utils/__init__.py", line 361
msg = f"invalid level choice: {level} (choose from {parser.log_levels})"
^
SyntaxError: invalid syntax
Is my installation incorrect? This is the first time I use this library, does anyone have any suggestions.
f-strings aren't supported for python 2.7. You need python 3.6 or above to use them. Here is a good workaround, in which you can use f-strings in below python 3.6.
I just installed the python stanford nlp which went fine :-
pip install stanfordnlp
from a python shell, I am trying to instantiate the package and I get the following error :-
>>> import stanfordnlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/__init__.py", line 1, in <module>
from stanfordnlp.pipeline.core import Pipeline
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/pipeline/core.py", line 9, in <module>
from stanfordnlp.pipeline.doc import Document
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/pipeline/doc.py", line 175
return f"<{self.__class__.__name__} index={self.index};words={self.words}>"
^
SyntaxError: invalid syntax
The line:
return f"<{self.__class__.__name__} index={self.index};words={self.words}>"
Indicates that the package is intended for Python 3.6 or higher. It is returning an f-string, which was introduced in version 3.6. You are running on version 2.7.
Time to upgrade?
Using Python 2.6.6
Trying to install dropbox python api..
Tried both ' pip install dropbox ' and ' python setup.py install '
Got this error... on import dropbox
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/dropbox/__init__.py", line 3, in <module>
from . import client, rest, session
File "/usr/lib/python2.6/site-packages/dropbox/client.py", line 22, in <module>
from .rest import ErrorResponse, RESTClient, params_to_urlencoded
File "/usr/lib/python2.6/site-packages/dropbox/rest.py", line 415
utf8_params = {encode(k): encode(v) for k, v in params.iteritems()}
^
SyntaxError: invalid syntax
am i doing anything wrong..?
It appears the code in the dropbox API uses dictionary comprehensions, which were not introduced until Python 2.7. This can also be seen on the PyPI page for this module, which lists 2.7 as the Python version needed. You will not be able to use this module unless you upgrade to Python 2.7. (According to this question it must be Python 2.7, as the API doesn't yet support Python 3.)