I am on Debian Linux and I am trying to install Pyinstaller, for making a standalone exe file from python script, into my debian linux. I downloaded from this link to get Pyinstaller. But can't find proper installation instruction and found one discussion here.
What I did was
(1) go to the pyinstaller folder and
sudo python setup.py
The error is
Traceback (most recent call last):
File "setup.py", line 14, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
(2) I don't have source/linux folder in my Pyinstaller folder according to the discussion in the second link.
Where can I find proper instruction for the installation. Even in this manual, it is not clear how to install for Linux.
Thanks
you need to install python-setuptools
sudo apt-get install python-setuptools
Installation pyinstaller:
You can pip install the pyinstaller
pip install pyinstaller
if you do not have pip then you can install pip using
sudo apt-get install python-pip
Related
I'm on Ubuntu 16.04, and I get:
Traceback (most recent call last):
File "/home/omermazig/.virtualenvs/fixi/bin/pip", line 7, in <module>
from pip import main
File "/home/omermazig/.virtualenvs/fixi/lib/python3.6/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/omermazig/.virtualenvs/fixi/lib/python3.6/site-packages/pip/utils/__init__.py", line 23, in <module>
from pip.locations import (
File "/home/omermazig/.virtualenvs/fixi/lib/python3.6/site-packages/pip/locations.py", line 9, in <module>
from distutils import sysconfig
File "/home/omermazig/.virtualenvs/fixi/lib/python3.6/distutils/__init__.py", line 25, in <module>
from distutils import dist, sysconfig
ImportError: cannot import name 'dist'
When I run anything with python. This specifically is for trying to run "pip freeze". What to do?
try it
sudo apt install python3-distutils
My case was when I upgraded Ubuntu 18 -> 19.
So it reinstalled python and what I needed to do is:
remove old virtual environment
create a new one
install requirements via pip into it
I ran into this problem after installing Python 3.8 on Ubuntu (I have version 16.04)
$ lsb_release -d
Description: Ubuntu 16.04.6 LTS
Reproduce the error
Just try to import distutils
$ python3 -c "from distutils import sysconfig"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)
$ sudo apt install python3-distutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3-distutils
The package python3-distutils cannot be found
$ sudo apt install python3-distutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3-distutils
list available distutils
What helped was to list all distutil packages using a regexp
$ apt list *distutils*
Listing... Done
python-distutils-extra/xenial,xenial 2.39-1 all
python-stsci.distutils/xenial,xenial 0.3.7-4 all
python3-distutils-extra/xenial,xenial 2.39-1 all
python3-stsci.distutils/xenial,xenial 0.3.7-4 all
python3.7-distutils/xenial,xenial 3.7.8-1+xenial1 all
python3.8-distutils/xenial,xenial 3.8.3-1+xenial1 all
python3.9-distutils/xenial,xenial 3.9.0~b4-1+xenial1 all
Install the correct distutils package
For my Python 3.8 I picked python3.8-distutils and it worked
$ sudo apt-get install -y python3.8-distutils
Since I run into this issue everytime I update my ubuntu version every six months, then stumble on the exact same SO result, here is my solution.
If the other solutions listed here don't work (installing python3-distutils), it might be because of different python versions between the system and the virtualenv.
The easy solution is to destroy your virtualenv, then recreate it from scratch.
Solved: I've just got this issue in a virtual environment installed 2 years ago, using python3.7
Running pip3 or python3.7 -c "from distutils import dist, sysconfig" from the venv, I got the error ImportError: cannot import name 'dist'
Using system python 3.9, this error disappers.
I solved copying the /usr/lib/python3.9/distutils into the python3.7 virtual environment.
Take a loot at this (similar problem):
https://github.com/pypa/pip/issues/5367
Possible fix:
Download Python source from https://www.python.org/
Decompress the source code
Install the following dependencies:
sudo apt-get install zlib1g-dev (needed to compile Python)
and install:
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev (needed by Pip to make SSL requests)
Compile and install Python:
/configure
make
make install
Python 3.6 with Pip should be installed.
Full credit to jonbesga.
I am trying to install something using "python setup.py install" but it shows me this error :-
Traceback (most recent call last):
File "setup.py", line 3, in <module>
from setuptools import setup
ImportError: No module named setuptools
I have installed this missing module using "pip install setuptools". But still it shows me the same error .I have also tried to install this using "sudo apt-get install python-setuptools" but the problem still remains the same. Help me in this issue
If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org, you will already have pip and setuptools, but will need to upgrade to the latest version:
On Linux or macOS:
pip install -U pip setuptools
On Windows:
python -m pip install -U pip setuptools
If you’re using a Python install on Linux that’s managed by the system package manager (e.g “yum”, “apt-get” etc…), and you want to use the system package manager to install or upgrade pip, then see link
I need help installing pydasm into python 2.7. The readme.txt file tells me that I have to enter python setup.py build_ext into the cli. When I do, I get the error:
Traceback (most recent call last):
File "setup.py", line 22, in <module>
raise DistutilsPlatformError()
distutils.errors.DistutilsPlatformError
If you can help, please let me know!
Since no one answered my question, I thought I would so if other people have the same issue they can look here for help.
I went to this site: http://ademata.blogspot.com/2010/07/installing-pydasm-and-pefile-module-on.html
Follow these instructions:
Pydasm is included with the module libdasm. An open source fork is available at http://libdasm.googlecode.com/svn/trunk/ svn/libdasm-read-only and requires the use of the subversion tool. To install subversion use sudo apt-get install subversion.
Run the following command to download the latest libdasm code:
svn checkout http://libdasm.googlecode.com/svn/trunk/ svn/libdasm-read-only
Run the following series of commands to install the module on python:
cd svn/libdasm-read-only/
make
sudo make install
cd pydasm
sudo apt-get install python2.6-dev
(use the most recent, so for me I did 2.7)
python setup.py build_ext
sudo python setup.py install
Pefile is included in Ubuntu's repository, to install the pefile module run sudo apt-get install python-pefile.
Hope this helped.
I'm using a clean instance of Ubuntu server and would like to install some python packages in my virtualenv.
I receive the following output from the command 'pip install -r requirements.txt'
Downloading/unpacking pymongo==2.5.2 (from -r requirements.txt (line 7))
Downloading pymongo-2.5.2.tar.gz (303kB): 303kB downloaded
Running setup.py egg_info for package pymongo
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named setuptools.command
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named setuptools.command
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/redacted/env/build/pymongo
Storing complete log in /home/redacted/.pip/pip.log
Any Idea what's going on?
python version 2.7.3
pip version pip 1.4 from /home/redacted/env/lib/python2.7/site-packages (python 2.7)
Try installing:
sudo apt-get install python-setuptools
if this doesn't work try:
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py
Edit: If you have several (possible conflicting) python installations or environments, the following commands can be useful to debug which executables are being used:
which python
which pip
which easy_install
They should "match". It can happen for example that you have pip installing packages for an EPD or global distribution while the current python that is being used corresponds to a local environment (or something different), in which case it might not be able to see the installed packages.
had the same problem, solved it with
pip install -U setuptools
Elaborating #elyase's Answer.
First check for which python version you want to install setuptools.
Normally both python versions comes default with debian or any linux distro.
So, as per your requirement install setup tools using apt package manager
For python 2.x
sudo apt-get install python-setuptools
For python 3.x
sudo apt-get install python3-setuptools
These instructions solved the problem for me:
first enter these commands
pip install --upgrade pip
pip install --upgrade wheel
pip install setuptools
and then try to install the package that requires setuptools.
I'm trying to generate .docx files using Python. I searched the web and posts here and found a module:
https://github.com/mikemaccana/python-docx/blob/master/README.markdown
It says to install using easy_install or pip, which I have no idea how to do. I went to python website to install pip from the instructions given on python documentation:
http://guide.python-distribute.org/installation.html
So I downloaded and followed directions:
$ tar xzf pip-0.7.2.tar.gz
$ cd pip-0.7.2
$ python setup.py install
But when I do python setup.py install, I get error message:
Johns-MacBook-Pro:pip-0.7.2 John$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 2, in <module>
from setuptools import setup
ImportError: No module named setuptools
Can someone please help me install step by step for a newb? Thanks in advance for all of your help!
Pip can install straight from the git repository
You just have to tell him to use git and give him the URL of the git rep
pip install git+git://github.com/mikemaccana/python-docx.git
You will also need to install lxml (as written in the setup.py) and PIL (as you will discover when you try to import the module).
pip install PIL
pip install lxml
pip install python-dateutil