Downloading Python Modules - python-3.x

I just installed Python3.4.2 yesterday on Windows 7. I tried typing out the command to download and install modules in the system terminal but I got Syntax Error. Within the terminal I typed: pip install pyPdf. Just wondering what my issue was.

Apparently, pyPdf is 2.x package
The raise syntax in Python 3.x no longer accepts comma-separated arguments
here is porting guide from 2.x to 3.x
http://docs.pythonsprints.com/python3_porting/py-porting.html

Related

"No module name adafruit_servokit"

I am working on Jetson Nano and trying to control servo motors. I am using PCA9685. I have installed all the pre-requisites for that
sudo pip3 install adafruit-circuitpython-servokit
Faced an error called
SyntaxError: future feature annotations is not defined
i updated python for that and the issue was resolved. Now the issue is that when i use python 3.8 as an interpreter in Visual studio i face the error
No module name adafruit_servokit
But when i use the python 3.6, the adafruit_servokit error is solved and the annotation error arises.
Looking forward to every suggestion. Thank you
This is because you have conflicting interpreters for your python installation.
Inside your Visual Studio terminal, try using:
python3.8 -m pip install adafruit-circuitpython-servokit
Using python -m pip install instead of just pip install is recommended. The reason is that it will use the correct interpreter for your python installation, specially if you have many versions installed. More details here: https://snarky.ca/why-you-should-use-python-m-pip/
---EDIT---
You should replace python3.8 with your target version number.

AWS CLI not working because of unsupported Python version

I'm trying to download the AWS CLI tools onto my mac. The error message is pretty clear Unsupported Python version detected: Python 2.7 To continue using this installer you must use Python 3.6 or later. The issue I'm having is that aliasing python to python3 isn't working. For some reason, after aliasing, the installer still references Python 2.7.
After aliasing through the cli didn't work for installing AWS CLI, I added alias python=python3 to my .zshrc file. Running python --version returns Python 3.9.6. Running the AWS installer still references the older version of python.
I'm hesitant to completely override the older version, because I've read from multiple sources that the default python on OS X should not be touched.
Can someone explain how I can reference the newer version of python when installing the AWS CLI tools?
while installation, choosing python3 worked well for me. Choose the "To install the AWS CLI version using the bundled installer" from here: https://docs.aws.amazon.com/cli/v1/userguide/install-macos.html
sudo /usr/local/bin/python3 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Replace /usr/local/bin/python3 with the path to your python binary with version >= 3.6.
My problem was that I was trying to download an old version of the awscli. After downloading the newest version I ran into some issues with the credentials file. Upon updating the credentials file and adding a config file in the .aws directory, everything worked as expected.

autopep8 not found in cygwin

If I try to use autopep8 in cygwin (64bit, WIndows10) i get the message "command not found".
$ autopep8
-bash: autopep8: command not found
I tried pip install autopep8 but pip is also not found, only pip2 and pip3.
If I use python -m pip install autopep8 it works so I can call
python -m autopep8
but I want to run a script where just autopep8 is called:
if ! type -p autopep8 >/dev/null; then
echo "autopep8 not found" >&2
autopep8() {
Any ideas how to solve this?
First, you must install PyPi packages to the correct Python installation, and second, you must install the same package to every Python installation in which you want to use it.
Now, a special note about installing Python on Cygwin. You have a choice of several Python versions to install, and scores of packages for use with each of those versions. Avoid Python version 2 unless you have a clearly define reason, as it is post End-of-Life. Instead, install one of the versions of Python 3. As of today, version 3.6 and 3.7 have the more complete sets of optional packages. Version 3.8 beta 4 is available.
For a my install of Python 3.8, I used the Cygwin setup app to install these packages: Python38 (Py3K language interpreter), Python38-pip (Python package installation tool), Python38-setuptools (Python package management tool), Python38-virtualenv (Creates isolated Python environments), and Python38-wheel (Python package format module). To write X11 GUI apps, add Python38-tkinter (Py3K Tkinter GUI module). To install binary packages, add Python38-devel (Py3K language interpreter).
You will be able to install pure Python packages from PyPI. To install binary packages you will also need to have the GNU compiler tool chain installed, and you will need to handle dependencies with other Cygwin packages on your own.
The Python 3.6 and 3.7 installations have addition packages which, in many cases, contain binary packages with the above mentioned dependencies already resolved, or have some useful customizations for the Cygwin environment.
Cygwin has both Python 2 and Python 3. As of today, after installation, you execute Python 2 by python and Python 3 by python3. Be careful which Python you execute as you may get a windows version of Python, if installed, and in your path. which python will always tell where the executable lives, and python -V, etc., will tell you which version you are running. Generally, you want to run a Cygwin version of Python from the bash prompt and Windows versions of Python only from the command prompt or windows GUI.
The safest way to use pip is to use the module version for the Python executable you have chosen, i.e., python -m pip, etc. This avoids having to also remember to use pip with Python and pip3 with Python3.

Does TensorFlow 1.9 support Python 3.7

I'm hesitating whether to downgrade to Python 3.6 or install a new version of TensorFlow.
Does TensorFlow 1.9 support Python 3.7?
I was able to install Tensorflow 1.12.0 with Python 3.7 on MacOS, with the following command.
sudo python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
Not yet. It seems there are some variables named "async", which has become a keyword in 3.7. Shouldn't be too difficult to fix, but still a problem.
Source: https://github.com/tensorflow/tensorflow/issues/20444
Probably not yet.
First of all, you will probably get a SyntaxError: invalid syntax because some parameters and variables at the pywrap_tensorflow_internal.py module have the name async which is a reserved keyword in Python 3.7.0 (see also this post).
However, you can solve this by simply changing the name of all these (Ctrl + R and Replace All) from async to for example async1.
The problem is that then you will probably get a ImportError: No module named '_pywrap_tensorflow_internal' which perhaps may be fixed for any previous version before Python 3.7.0 as this post on StackOverflow suggests but personally I could not fix it on my laptop with Python 3.7.0 .
Consequently, I simply downgraded to Python 3.6.6 and now Tensorflow is working fine.
There is a whl built here. However in my run it was cpu version.
https://www.lfd.uci.edu/~gohlke/pythonlibs/
as of Aug 26tH, there is an update on the tensorflow github site
https://github.com/tensorflow/tensorflow/pull/21202
Tensorflow 1.13.1 now supports Python 3.7.
According to the comments on github
see
https://github.com/tensorflow/tensorflow/issues/20517#issuecomment-457185528
by member av8ramit
"We are aiming to try and have Windows and Ubuntu python binaries by rc2 or the official."
the estimated release date for 2019-02-03
however on
https://github.com/winpython/winpython/issues/687
one can read from a winpython contributor:
"Tensorflow-2 is 2019, Tensorflow-1 on Python-3.7 is still not in sight"
Finally Worked for me!
On Python 3.6.4 (even 3.6.5 failed for me)
Install Python3.6.4 from here:
https://www.python.org/downloads/mac-osx/
If you're facing issues with Python pkgs that you already had on you older version just revert it using this post:
python location on mac osx
I found this to work after searching for a while.
As Tensorflow only supports Python 3.6 as of now, you can install a different version of python alongside your standard one. Here are the steps I followed:
Download the Python3.6 tgz file from the official website (eg. Python-3.6.6.tgz)
Unpack it with tar -xvzf Python-3.6.6.tgz
cd Python-3.6.6
run ./configure
run make altinstall to install it (install vs altinstall explanation here Difference in details between "make install" and "make altinstall")
You'll normally find your new python install under /usr/local/bin. Now you can create a new virtualenv specifying the python version with:
virtualenv --python=python3.6 env3.6
Get into the virtualenv running the command source env3.6/source/bin/activate.
Install tensorflow with the classic pip install tensorflow
Profit
First of all,
*conda create -n yourenvname python=3.6
*conda activate yourenvname
*pip install tensorflow
then it will work like rock.

qfrm module - No module named 'qfrm.Options' (Python 3.5.1)

I am quite newbie in python and I am trying to make the qfrm 0.2.0.27 library to work. Unfortunately there is no documentation about this library. I installed it using pip and when I try to import it I get the following error:
No module named 'qfrm.Options'
Does anyone have a solutions for this? I am using python 3.5.1. and PyCharm
I also ran into this problem. The current version in the PyPi index is qfrm-0.2.0.27.
The version on the website appears to be qfrm-0.2.0.23. Although it is older, it worked without error for me.
If you download the ...23 whl file and install that one (pip install [file_name].whl) you may find it works better.
I'm on Python version 2.7.11 and was unable to install qfrm version 0.2.0.27 and received the error message: No module named 'qfrm.Options'
However, I was able to install qfrm version 0.2.0.23, as follows: pip install -v qfrm==0.2.0.23

Resources