import tensorflow SyntaxError: invalid syntax - macos

Using Virtualenv on Mac I have encountered the showing SyntaxError when I
import tensorflow
I tried many times uninstall but now working... please help me!

Tensorflow is not supported on Python 3.7. You'll need to use python3.6 or earlier.
async which was fine as a variable name in earlier versions of Python, is a keyword in Python 3.7. This is why it is failing to import.

Related

ImportError: cannot import name 'HfApi'

first time using hugging face transformers library and it's not getting through the import statement.
Running on Conda virtual environment Python 3.6
I also tried this below with the huggingface_hub library, and the error message is the same.
from huggingface_hub import HfApi
hf_api = HfApi()
models = hf_api.list_models()
I also faced a similar issue on my Python 3.6 environment. Installing hugging face on an environment with greater Python version was solved the issue.

shiboken2 & PySide2 issues

I get this error when trying to run a PyQt5 Application, I keep getting it and I think it's when I use pyuic5 to export code from QT Designer and then try to run it.
from .shiboken2 import *
ImportError: DLL load failed: The specified procedure could not be found.
I have used pip freeze to find the versions of shiboken2 and pyside2 and they are both the same version.
I installed Python 3.7 + And it works.

pyinstaller gives weird errors when compiling pandas

UPDATE june 18:
I would like compiling my python code for windows.
I use to work with pyinstaller, python 3.5+, windows 7 and anaconda to control modules pandas, pyqt (v5) and pyqtgraph, but it seems something is not compatible. I would not be surprised if you tell me to change a version.
In previous versions, it worked with python 3.5, windows 7 and Pyinstaller 3.3.1- without pandas; the new version imports pandas and then this doesn’t work anymore:
with the usual config pyinstaller gives a message saying the C libraries are not built. Following the instructions, I should run python setup.py build_ext --inplace --force, except I don’t see the setup.py file, so I don’t know what to do. Forums tell me it should be a problem with pip but not with conda… but I use conda…
with python 3.6, I got an error message ‘RecursionError: maximum recursion depth exceeded’ (https://github.com/steph2016/profiles/blob/master/errorMessage). This problem seems known and solutions I found on forums is either to downgrade python or to replace my PyInstaller-3.3.1 by PyInstaller-3.4.dev0+7b3143612. But with PyInstaller-3.4.dev0+7b3143612 I get a ’’str’ object has no attribute ‘items’’ error (https://github.com/steph2016/profiles/blob/master/ErrorMessage2). I’m not sure pyinstaller is compatible with python 3.6…
with python 3.4, I got an error similar to the ‘str object’ one above. I’m not sure python3.4 is compatible with qt5…
I would be pleased by any solution with any version of whatever to windows-compile my code
I don't know if it is the issue but I didn't find PyQtGraph in Supported-Packages
I eventually applied the first solution proposed in No module named 'pandas._libs.tslibs.timedeltas' in PyInstaller in the original config (python 3.5, PyInstaller 3.3.1, pyqtgraph, pandas, windows 7,...) and it worked.
I don't know why adding def get_pandas_path ..... a.binaries) helps, so I can't justify. But just to be explicit even if it seems obvious: pyinstaller must be run on the spec file, not on the py one (for instance > pyinstaller toto.spec)

bash: kivy: command not found

I followed the instructions in this link about Kivy installation "Using Homebrew with pip".
However, when I tried to run the code given below:
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text='Hello World')
TestApp().run()
It gave me an error:
bash: kivy: command not found
if you installed kivy with pip, you don't need a kivy command, you can use python directly.
python main.py
Because I created a virtual environment to isolate all the things that needs to be installed like kivy, and I installed cython and kivy first before the homebrew, it caused the problem. Even if I use:
python main.py
instead of
kivy main.py
What I did to solve it are the following:
1. Created a new virtual environment
2. Followed the instruction in kivy in right order: (1) homebrew, (2) Cython, then (3) Kivy.
3. Used "python" command instead of "kivy" command because I installed it using pip (refer to the commenr above). For example:
python name_of_your_file.py
Kivy documentation must be confusing that's why.

IPython.parallel.Client() not working

There is no problem when I import IPython.parallel -->import IPython.parallel
However, when I try this:
rc=IPython.parallel.Client()
I get the following error:
/home/mycomputer/local/lib/python2.7/site-packages/IPython/utils/shimmodule.pyc in __getattr__(self, key)
90 return import_item(name)
91 except ImportError:
---> 92 raise AttributeError(key)
AttributeError: Client
Does anyone know the solution to this?
[I am using Ubuntu 14.04]
It might be a problem with IPython 4.0's shim. IPython.parallel has moved to a new package, ipyparallel, so if you are using 4.0:
import ipyparallel
rc = ipyparallel.Client()
It's possible that the failure is that you don't have ipyparallel, and you are getting an unfortunately uninformative failure instead of a nice, useful error message. In that case:
pip install --upgrade ipyparallel
(or conda install, depending on your Python packaging of choice).

Resources