py2exe 1 missing modules, readline - module

I have problems in py2exe. I simply want to "convert" a .py file into a .exe file, which i can easiely run on my PC, but if i run py2exe a error message appears:
Here is my setup.py:
from distutils.core import setup
import py2exe, sys, os
setup(console=['filename.py'])
And the error message it the following:
1 missing Modules
? readline imported from cmd, code, pdb
Building 'dist\filename.exe'.
error: [Errno 2] No such file or directory: 'C:\\Users\\Name\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\site-packages\\py2exe\\run_w-py3.5-win32.exe'
I hope you guys can help me ;)
greetz

May you should install readline package first.
This package dones't work in Windows by default.
If you are in Windows,You should use pyreadline instead of readline
pip install pyreadline
It works to me.

Related

Pip install does not work, matplotlib seems to be broken, pyenv and fresh new install doesn't work

So I wanted to import matplotlib to my virtual python version of 3.10.0 (and other versions). I install it as usual:
pip install matplotlib
Everything seems to work, no errors show up with pip. But when I try to run this code snippet in vs code (to see if mpl works):
import matplotlib
print(matplotlib.__version__)
It outputs this:
File "/Users/XYZ/Desktop//pienv.py", line 1, in <module>
import matplotlib
File "/Users/XYZ/Desktop//matplotlib.py", line 1, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package
But when I do the same in the terminal it outputs the correct version.
It doesn't matter if I have python installed with dmg file or with pyenv, result is the same.
I tried to format operating system to ensure there is no os trash that might be getting in a way. Then I just installed python with pyenv.
I'm using osx 12.0.1
My vscode setup is straightforward, just python extension and python interpreter set to what pyenv has as a local python.
Is there that can be done, or that I'm doing wrong?
Found the answer.
It's just a stupid thing.
Don't name your projects with the names of your libraries when they're in the same directory.

when entering pip install numpy recieved syntax error

new to python and trying to learn some data science, Ive downloaded python 3.8.3 for windows64 two the few things I learned at during the short free trial.
when trying to install numpy I received a syntax error, even though pip was imported and the path is shown.
>>> pip
<module 'pip' from 'C:\\Users\\owner\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-
packages\\pip\\__init__.py'>
>>> pip install numpy
SyntaxError: invalid syntax
typing python in windows command prompt just brings up the windows store on the python app, and typing pip doesn't find anything as well.
C:\Users\owner>pip
'pip' is not recognized as an internal or external command,
operable program or batch file.
in general, it seems that none of the commands that aren't print() or help() is working.
what did I do wrong?
Make sure that you add Python to System Environment PATH when you are installing python.
If you didn't try this command to add it to your PATH
setx PATH "%PATH%;C:\Python34\Scripts"

ModuleNotFoundError: No module name 'Cython'

I am trying to install pandas module on PyCharm. When i try to install it it gave me this error: "ModuleNotFoundError: No module name 'Cython' " (Screen: https://prnt.sc/qafwcy)
So i went on the CMD to try to install the Cython package with this command: py -m pip install Cython , which gave me an other error: "The script, f2py.exe is install in 'C:\xxx.xxxx, which is not a PATH. (Screen: https://prnt.sc/qafvx3)
Does anyone had the same problem and know how to fix it?
Thank you
Pycharm uses a virtual environment - one separate from your python install on your computer. This is to isolate your development environment from the one you would use on your computer.
Enter your pip commands here instead:

Object Detection API error: "ImportError: cannot import name anchor_generator_pb2"

I'm trying to get Tensorflow's new Object Detection API working. I've followed the installation instructions, but when running the command
python object_detection/builders/model_builder_test.py
I get the following error
from object_detection.protos import anchor_generator_pb2
ImportError: cannot import name anchor_generator_pb2
I've looked inside object_detection.protos, and there doesn't seem to be anything named anchor_generator_pb2. Has anyone else managed to get this command to run, or solved this issue?
Missed a step in the installation instructions, where the following needs to be run from models/research:
protoc object_detection/protos/*.proto --python_out=.
You need to rerun the below command after that:
pip install .
This worked for me
Run it from your models/research
python setup.py
protoc -I=./ --python_out=./ ./object_detection/protos/*.proto
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim

How to install modules for Python 2.7 on Ubuntu 10.10?

On Ubuntu 10.10, I am unable to install lxml to python 2.7. Here are the steps I take.
sudo su -
apt-get install python2.7
apt-get install python-lxml
Note when running the install for python-lxml package, the following appeared:
INFO: using unknown version '/usr/bin/python2.7' (debian_defaults not up-to-date?)"
Importing the module in python2.6 (the version that comes standard with Ubuntu) works. However, importing the module under python2.7 does not. So how does one install Python modules to a non-default Python installation?
Try to install libxml2, libxml2-dev, libxslt, libxslt-dev, python-dev. These are header files. Then try to install lxml again.
On Ubuntu 10.10 the python packages installed from the repositories get installed to /usr/lib/python2.6/dist-packages so one option is to add this path to your $PYTHONPATH environmental variable so python2.7 will look to the python2.6 directory for the libs.
What I've done on Ubuntu 10.10 is add
export PYTHONPATH="$PYTHONPATH:/usr/lib/python2.6/dist-packages"
to my .bashrc file, and also to my .gnomerc file. This sets the $PYTHONPATH for python instances started from the shell or from the gnome desktop. You should then be able to import the python libs which you have installed from the Ubuntu repositories in python2.7.
.bashrc and .gnomerc are both located in your home directory; you might have to create .gnomerc if it doesn't already exist. And one caution: I had a syntax error in my .gnomerc which stopped the gnome desktop from loading, and I couldn't log in. I had to use a recovery console to fix this syntax error and then I could log in again.
This seems a little hackish to me, so I'm interested in hearing better solutions.
Another solution might be to use the following code:
try:
from lxml import etree
except ImportError:
try:
# Python 2.5
import xml.etree.cElementTree as etree
except ImportError:
try:
# Python 2.5
import xml.etree.ElementTree as etree
except ImportError:
try:
# normal cElementTree install
import cElementTree as etree
except ImportError:
try:
# normal ElementTree install
import elementtree.ElementTree as etree
except ImportError:
print("Failed to import ElementTree from any known place")
[Source]
This will import lxml if it is available, or the original ElementTree otherwise.
I use this code for my application on Google App Engine (using Python 2.7): on the server it will use lxml, on my machine it will use ElementTree.
I have one easiest trick Just open synaptic package manager type "python-lxml" in search box it will show you all the dependencies and available packages select packages which you want to install and hit apply.