Python setup py install not working

I've been using python for a while but I can't remember how I used to install modules, I haven't needed to in forever. I recently reinstalled ubuntu so now I need to.

Firstly, I try to run setup.py and get this:

nicholas@nicholas-K53E:~$ python setup.py install
python: can't open file 'setup.py': [Errno 2] No such file or directory

I tried using synaptic to install BeautifulSoup but it didn't work either and python tells me there's no modules named that.

Some forums said that it had to do with being in the wrong working directory so I cd'd into my Python26 folder and tried to run python ./setup.py install from there and it still didn't work. I'm not sure what the deal is.

Any guidance?

asked Aug 23, 2012 at 0:19

2

sudo apt-get install python-setuptools

OR

sudo aptitude install python-setuptools

Then just run:

sudo easy_install 

e.g.

sudo easy_install BeautifulSoup

answered Aug 23, 2012 at 0:36

DavidDavid

6,2792 gold badges24 silver badges21 bronze badges

sudo aptitude install python-beautifulsoup should do that for you. Synaptic is alright, but I prefer aptitude for many reasons [CLI is one of them obviously]. Most of the modules you want should be available through your package manager, and beautifulsoup should definitely be. If that command does not work for you, there are other issues you need to look at.

You should definitely be able to use easy_install for more popular packages and well, and as far as utilizing setup.py you need to be in a directory actually containing it. What does ls | grep setup.py return for you when you are in the proper working directory? setup.py typically comes with a downloaded package, so make sure you are actually in the folder containing that package.

answered Aug 23, 2012 at 0:32

jaypbjaypb

1,50410 silver badges22 bronze badges

1

See other answers that recommend using the package manager that comes with Ubuntu [aptitude]. This is the easiest way to do it.

However, to answer your specific question, to install a package based on the Distutils you need to download the package, extract it, and then run the setup.py script.

As an example for BeautifulSoup:

Download the package from Beautiful Soup 4.1.3 [at time of writing get the beautifulsoup4-4.1.3.tar.gz tarball].

wget //www.crummy.com/software/BeautifulSoup/bs4/download/beautifulsoup4-4.1.3.tar.gz
tar xvfz beautifulsoup4-4.1.3.tar.gz
cd beautifulsoup4-4.1.3
sudo python setup.py install

answered Aug 23, 2012 at 0:42

mhawkemhawke

81.6k9 gold badges113 silver badges135 bronze badges

Sudo command will not work in Windows.

If you have something to install don't use Sudo, instead directly install your file:

for ex: If you sudo python3 setup.py install

then windows users can just type setup.py install

answered Jun 17, 2017 at 18:51

Are you using windows? if so, replace the python with C:\python39\python.exe and type in the rest of the command.

answered Aug 15, 2020 at 3:45

  1. What is your operating system and version?

Mac

Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64

  1. What is your Python version?

Python 3.6.8 :: Anaconda custom [64-bit]

  1. What version of pip do you have?

pip 18.0 from /Users/jonathan/anaconda3/lib/python3.6/site-packages/pip [python 3.6]

  1. Could you describe your issue in as much detail as possible?

I am trying to install a package locally using python setup.py install. It seems to run setup.py correctly, but when I import the module and run it using IPython or Jupyter, the version I just installed is not imported, an older version is imported.

The package can be found here:

//github.com/biblicalhumanities/greek-syntax

When I run python setup.py install,

Here is the output from the command:

$ python: python setup.py install
options [after parsing config files]:
options [after parsing command line]:
option dict for 'aliases' command:
  {}
option dict for 'install' command:
  {}
running install
Distribution.get_command_obj[]: creating 'install' command object
config vars:
{'abiflags': 'm',
 'base': '/Users/jonathan/anaconda3',
 'dist_fullname': 'greeksyntax-0.1.dev0',
 'dist_name': 'greeksyntax',
 'dist_version': '0.1.dev0',
 'exec_prefix': '/Users/jonathan/anaconda3',
 'platbase': '/Users/jonathan/anaconda3',
 'prefix': '/Users/jonathan/anaconda3',
 'py_version': '3.6.8',
 'py_version_nodot': '36',
 'py_version_short': '3.6',
 'sys_exec_prefix': '/Users/jonathan/anaconda3',
 'sys_prefix': '/Users/jonathan/anaconda3',
 'userbase': '/Users/jonathan/.local',
 'usersite': '/Users/jonathan/.local/lib/python3.6/site-packages'}
Distribution.get_command_obj[]: creating 'build' command object
  setting options for 'easy_install' command:
Distribution.get_command_obj[]: creating 'install_lib' command object
Distribution.get_command_obj[]: creating 'install_scripts' command object
running bdist_egg
Distribution.get_command_obj[]: creating 'bdist_egg' command object
Distribution.get_command_obj[]: creating 'egg_info' command object
Distribution.get_command_obj[]: creating 'bdist' command object
running egg_info
writing greeksyntax.egg-info/PKG-INFO
writing dependency_links to greeksyntax.egg-info/dependency_links.txt
writing requirements to greeksyntax.egg-info/requires.txt
writing top-level names to greeksyntax.egg-info/top_level.txt
Distribution.get_command_obj[]: creating 'build_py' command object
reading manifest file 'greeksyntax.egg-info/SOURCES.txt'
exclude_pattern: applying regex r'[^|\/][RCS|CVS|\.svn]\/'
writing manifest file 'greeksyntax.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-x86_64/egg
  setting options for 'install_lib' command:
running install_lib
running build_py
creating build/bdist.macosx-10.7-x86_64/egg
creating build/bdist.macosx-10.7-x86_64/egg/greeksyntax
copying build/lib/greeksyntax/treedown.css -> build/bdist.macosx-10.7-x86_64/egg/greeksyntax
copying build/lib/greeksyntax/lowfat.py -> build/bdist.macosx-10.7-x86_64/egg/greeksyntax
copying build/lib/greeksyntax/rules.css -> build/bdist.macosx-10.7-x86_64/egg/greeksyntax
copying build/lib/greeksyntax/boxwood.css -> build/bdist.macosx-10.7-x86_64/egg/greeksyntax
copying build/lib/greeksyntax/xml.py -> build/bdist.macosx-10.7-x86_64/egg/greeksyntax
copying build/lib/greeksyntax/__init__.py -> build/bdist.macosx-10.7-x86_64/egg/greeksyntax
copying build/lib/greeksyntax/#lowfat.py# -> build/bdist.macosx-10.7-x86_64/egg/greeksyntax
copying build/lib/greeksyntax/03-luke.xml -> build/bdist.macosx-10.7-x86_64/egg/greeksyntax
byte-compiling build/bdist.macosx-10.7-x86_64/egg/greeksyntax/lowfat.py to lowfat.cpython-36.pyc
byte-compiling build/bdist.macosx-10.7-x86_64/egg/greeksyntax/xml.py to xml.cpython-36.pyc
byte-compiling build/bdist.macosx-10.7-x86_64/egg/greeksyntax/__init__.py to __init__.cpython-36.pyc
creating build/bdist.macosx-10.7-x86_64/egg/EGG-INFO
copying greeksyntax.egg-info/PKG-INFO -> build/bdist.macosx-10.7-x86_64/egg/EGG-INFO
copying greeksyntax.egg-info/SOURCES.txt -> build/bdist.macosx-10.7-x86_64/egg/EGG-INFO
copying greeksyntax.egg-info/dependency_links.txt -> build/bdist.macosx-10.7-x86_64/egg/EGG-INFO
copying greeksyntax.egg-info/requires.txt -> build/bdist.macosx-10.7-x86_64/egg/EGG-INFO
copying greeksyntax.egg-info/top_level.txt -> build/bdist.macosx-10.7-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/greeksyntax-0.1.dev0-py3.6.egg' and adding 'build/bdist.macosx-10.7-x86_64/egg' to it
removing 'build/bdist.macosx-10.7-x86_64/egg' [and everything under it]
Processing greeksyntax-0.1.dev0-py3.6.egg
Removing /Users/jonathan/anaconda3/lib/python3.6/site-packages/greeksyntax-0.1.dev0-py3.6.egg
Copying greeksyntax-0.1.dev0-py3.6.egg to /Users/jonathan/anaconda3/lib/python3.6/site-packages
greeksyntax 0.1.dev0 is already the active version in easy-install.pth

Installed /Users/jonathan/anaconda3/lib/python3.6/site-packages/greeksyntax-0.1.dev0-py3.6.egg
Processing dependencies for greeksyntax==0.1.dev0
Searching for BaseXClient==8.4.4
Best match: BaseXClient 8.4.4
Adding BaseXClient 8.4.4 to easy-install.pth file
Installing sample script to /Users/jonathan/anaconda3/bin

Using /Users/jonathan/anaconda3/lib/python3.6/site-packages
Finished processing dependencies for greeksyntax==0.1.dev0

How do I run Python setup py?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

What is setup py in Python?

The setup.py file may be the most significant file that should be placed at the root of the Python project directory. It primarily serves two purposes: It includes choices and metadata about the program, such as the package name, version, author, license, minimal dependencies, entry points, data files, and so on.

Does pip need setup py?

As a first step, pip needs to get metadata about a package [name, version, dependencies, and more]. It collects this by calling setup.py egg_info . The egg_info command generates the metadata for the package, which pip can then consume and proceed to gather all the dependencies of the package.

Does pip install run setup py?

pip is a package manager, which can install, upgrade, list and uninstall packages, like familiar package managers including: dpkg, apt, yum, urpmi, ports etc. Under the hood, it will run python setup.py install , but with specific options to control how and where things end up installed. In summary: use pip .

Chủ Đề