I'm having a bit of trouble trying to install Tkinter on a Linux system without having root privileges. According to the second answer to this question: Install tkinter for Python there is a way, and it involves downloading the source of Tkinter and TCL and then running their install routines in custon directories created one level below the home directory. I did that and everything except for the last step where it says run setup.py build and setup.py install. I can't find these files anywhere, an can't build them either. Does anyone know what the lasts tep of this routine is, and could possibly expound upon it? Thanks.
For reference: the sequence of instructions for installing the sources once you have the tar files is the follwing:
cd ~/tcl8.5.11/unix
./configure --prefix=/home/<user> --exec-prefix=/home/<user>
make
make install
cd ~/tk8.5.11/unix
./configure --prefix=/home/<user> --exec-prefix=/home/<user> --with-tcl=/home/<user>/tcl8.5.11/unix
make
make install
don't have sufficient reputation points to comment, but isn't this question Install Tkinter in linux similar to yours??.
To summarize, if you are sure that Tkinter is not already installed (and not that your python path is not correctly configured), I would suggest you to use some tools like easy_install and then do
easy_install --prefix=<local-dir-in-python-path> python-tk
generally I use ~/.local/ as the prefix.
easy_install can be installed by installing setuptools
Related
I am trying to install labelImg using setup.py. I run the command:
sudo python3 setup.py install
to install it and everything seemed to be fine. Unfortunately when I tried to execute the program (just tried labelImg &) got an import error:
ImportError: No module named 'resources'
So, I was wondering if I did something wrong or if there something I could do to fix it. My first thought is to provide an absolute import path to resources (and to the following libs imports) but that does not seem the right thing to do. Also it might work for a small project but it's obvious out of reach for a big one.
The git repo seem to imply that I should run it via python, but why then a setup.py exists?
I know I can use the program via python or even install it via PyPI but I am not interested in that.
The labelImg project depends on other libraries to work such as pyqt5-dev-tools and lxml.
If you check their documentation, first you have to install pyqt5-dev-tools:
sudo apt-get install pyqt5-dev-tools
Then install lxml:
sudo pip3 install lxml
After that you have to run the make command in order to build the pyqt5-dev-tools library so that the python code can use it properly (make is used to build executable libraries and programs from source code):
make qt5py3
And finally you can run python3 labelImg.py and use labelImg.
I've created a new RPM using python bdist_rpm . Normally python setup.py install would install python dependencies like websocket-client or any other package. But the RPM just refuses to install anything.
Apparently the suggestion from various other posts seem to be in the line of just requiring them in setup.cfg as rpm packages. This doesn't make sense to me since most of the rpm packages seem to be on really old version and I can't possibly create rpms for all the python packages i require. I need a much recent version and it doesn't make sense that the yum installs don't actually install the packages.
What is the right (clean and easiest) way to do it ? I believe if a setup.py has something like
install_requires=[
"validictory",
"requests",
"netlogger>=4.3.0",
"netifaces",
"pyzmq",
"psutil",
"docopt"
],
Then it should try to either include them in the rpm or try to install it.
I am trying on a clean centos vm using vagrant which I keep destroying and then install the rpm.
Well the super hack way i used was to just add a post install script with all the requirements as easy_install installation (instead of pip because older versions may not have pip and even after installing pip, the approach failed on systems with python 2.6)
#Adding this in setup.py
options = {'bdist_rpm':{'post_install' : 'scripts/rpm_postinstall.sh'}},
Then the script is as follows:
easy_install -U <pkgnames>
Of course a post_uninstall can also be added if you want to clean up which I wouldn't because you have no clue what is using the packages installed apart from this app.
The logic of the rpm approach seems to be for this but its honestly over engineering and I'd rather package all the modules with the rpm to ensure it always works. ** Screaming out for a cleaner solution **
I am trying to install wxPython from src as I need the exact version 3.0.2.0 on Ubuntu. (So, I cannot follow the suggesion in the related question) I downloaded the source and did ./configure, make and make install. It seems to have ended without errors with the following message.
The installation of wxWidgets is finished. On certain platforms
(e.g. Linux) you'll now have to run ldconfig if you installed a
shared library and also modify the LD_LIBRARY_PATH (or equivalent)
environment variable. wxWidgets comes with no guarantees and
doesn't claim to be suitable for any purpose.
I confirmed my installation is not working by doing import wx & wx.version(). What needs to be done to complete the installation? Where should I set the LD_LIBRARY_PATH to?
Doing ./configure, make and make install only builds and installs wxWidgets. You also need to build wxPython using the build-wxpython.py script, which by default will also do the wxWidgets portion of the build for you, using known good configure flags. See wxPython/docs/BUILD.txt in the source tarball.
Try to check if wx is in sys.pah.
You can do it with this code
import sys
print sys.path
In output must be something like that /usr/lib/python2.7/dist-packages/wx
If not, adding path to wx folder to system path should solve your problem.
gtk3 should be install first
$sudo apt-get libgtk-3-dev
If you are facing problem to install wxpython on Python3 please use this command to install wxpython
$ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython
By this command you can install latest wxPython4 version.
If you are using Windows or macOS
$ pip install -U wxpython
Older Version you can get from this link
https://sourceforge.net/projects/wxpython/files/wxPython/
Two options in setup.py develop and install are confusing me. According to this site, using develop creates a special link to site-packages directory.
People have suggested that I use python setup.py install for a fresh installation and python setup.py develop after any changes have been made to the setup file.
Can anyone shed some light on the usage of these commands?
python setup.py install is used to install (typically third party) packages that you're not going to develop/modify/debug yourself.
For your own stuff, you want to first install your package and then be able to frequently edit the code without having to re-install the package every time — and that is exactly what python setup.py develop does: it installs the package (typically just a source folder) in a way that allows you to conveniently edit your code after it’s installed to the (virtual) environment, and have the changes take effect immediately.
Note: It is highly recommended to use pip install . (regular install) and pip install -e . (developer install) to install packages, as invoking setup.py directly will do the wrong things for many dependencies, such as pull prereleases and incompatible package versions, or make the package hard to uninstall with pip.
Update:
The develop counterpart for the latest python -m build approach is as follows (as per):
From the documentation. The develop will not install the package but it will create a .egg-link in the deployment directory back to the project source code directory.
So it's like installing but instead of copying to the site-packages it adds a symbolic link (the .egg-link acts as a multiplatform symbolic link).
That way you can edit the source code and see the changes directly without having to reinstall every time that you make a little change. This is useful when you are the developer of that project hence the name develop. If you are just installing someone else's package you should use install
Another thing that people may find useful when using the develop method is the --user option to install without sudo. Ex:
python setup.py develop --user
instead of
sudo python setup.py develop
Someone please tell me I'm not crazy, becuase I really feel like I am right now.
Ok so, I'm trying to setup a webapp with python and django using heroku, but I've hit quite an odd obstacle.
It wants me to setup a virtualenv using the command $ virtualenv venv --distribute, which is all well and good except:
yeh, so naturally I googled how to install virtualenv and I found this:
But, of course:
So I continued my search by trying to find out how to install pip and I found this:
Aaaaaaand that's when I completely lost my marbles because apparently you need to install pip to install virtualenv to install pip. (maybe not, but that's why I'm a noob and I need help).
But then I took another look at the vitualenv installation guide, and found that I could download it and install it manually, so I extracted all the files from the downloaded archive into my python33 folder and used setup.py install. And I got this:
So I changed the line in that file to except ValueError as e and I got another error from a different python file in that same folder so I reverted the change I made and decided that it probably was not a good idea to meddle with those scripts.
Please, any help at all to do with setting up a free server with python and django would be greatly appreciated. Furthermore, I am sorry if my question is stupid, or incorrectly tagged.
You are following install guides for linux. You should try to find an install guide for pip and virtualenv on windows. First install pip systemwide and then use pip to install virtualenv systemwide. Then start using virtual environments.
Start with How to install pip on W$ and Python and virtualenv on W$. An alternative is the Hitchhiker's guide to python.
Edit
As Ron Elliott states in the comments,
you'll need to point your path to C:\Python2x\Scripts or C:\Python3x\Scripts in order to pick
up easy_install and pip as well as any other script executables
installing to that directory.
But then I took another look at the vitualenv installation guide, and
found that I could download it and install it manually, so I extracted
all the files from the downloaded archive into my python33 folder and
used setup.py install.
You downloaded the package and run setup.py install in wrong folder, that's why it didn't work.
You should:
Download the archive virtualenv-1.10.tar.gz to a Downloads folder (or where ever you want)
Extract it, you will have a folder name virtualenv-1.10
Go to (cd) the extracted folder
Run command: python setup.py install
Anyway I would recommend installing setuptools and pip first, then you can install virtualenv from pip: pip install virtualenv.