How do I install tkinter on Python 3.6 on Debian? - python

My partner decided to use Debian for our dedicated server, whereas I am more of an Arch Linux person. But alas, people online recommended Debian to him so we ended up using that.
The issue is: some of our projects use matplotlib, which requires tkinter. However, this package was NOT installed when we installed python3.6 using apt-get.
A few google searches recommended apt-get install python3-tk, but this installed tkinter for python3.4, which Debian came with (which is odd to me as 3.6 is fairly standard these days).
As python3.6-tk was not listed, I decided to ask for help in here.

Related

Development using different version of Python

I'm developing a website using a server with Debian 8.10 (Jessie) as its OS and Python 3.4.2 (the supported Python version for Debian Jessie) while my notebook is using Ubuntu 16.04 and Python 3.5.2 (I think it's also the default version for Ubuntu 16.04). I was planning to build my website using Django 1.11 which both Python versions (3.4 and 3.5) support.
Is there any compatibility issues when I develop it using my Python 3.5.2 and deploy it to a Python 3.4.2 server? If any, how much the trouble it will be?
I know I can install any version of Python by adding someone's repository, but it seems unofficial so I avoid doing it. And there is a workaround that come to my mind: intall a specific version of Python by download its tarball file from the official website
Which will you recommend most?
Upgrade my server's Python version to 3.5.2 by adding someone's repo
Download Python 3.4.2's tarball and install it to my local machine
Upgrade my server's OS to Debian 9 Stretch which its default Python version is 3.5.3
Or any other better idea? Or perhaps you have a way to install specific Python version?
*I have some concern on security and safety
When you are working with different Python versions, it is recommended that you use some kind of virtual environment so each project has its own python version with its own modules that you need.
In this way, you can always keep each project with the Python version that you know it will work and with total compatibility with all the modules that you are using, making sure that any update to your working modules does not break anything in your past projects.
You should install a virtual environment in your local machine that matches the server machine and match the Python version and the modules that you have available, then start developing from there.
This space is a little bit too short to explain how to work with them, but you can find information about them here: https://docs.python.org/3/tutorial/venv.html
Optionally, you could use anaconda and its own version of enviroments, that may be simpler if you are familiar with conda

Bottle Version Python Web Framework

Need help with bottle, I have a clean installation of Ubuntu 11.10, i'm
trying to get bottle with the next command : sudo apt-get install python-bottle, and i get the bottle version 0.9.5-1 , that's not the last one(0.10.6-1) and does not include some features that i need.
Anybody knows why? I do not want to use easy-install or pip, help!
You'd need to upgrade your Ubuntu installation to precise (version 0.10.6) or to quantal (version 0.10.11).
Older Ubuntu releases do not get new versions of packages; python-bottle is also not part of the Ubuntu backports packages.
I strongly advise you to use a virtualenv and install the latest bottle version in there with pip. Ubuntu packages are not agile enough to follow the faster release cycles of many Python packages.

Do I need to install Homebrew if I am planning to install Virtualenv?

Being fairly new to programming, I am having trouble understanding exactly what Homebrew does... or rather - why it is needed. I know it contains pip for package management, but so does Virtualenv and I'm planning on installing this in due course.
Does Homebrew install another version of python that is not the system version, upon which you would install Virtualenv and manage the different development environments from there?
I have a clean install of OSX Lion and I want to keep my projects separated, but am unsure why I need Homebrew.
I realise this is basic stuff, but if someone could explain it, I would be grateful.
Homebrew is just a package manager for Mac, like pip for Python. Of course you never need a package manager, you can just get all the programs, or libraries in case of pip and Pypi yourself. The point of package managers however is to ease this process and give you a simple interface to install the software, and also to remove it as that is usually not so simply when compiling things yourself etc.
That being said, Homebrew will only install things you tell it to install, so by just having Homebrew you don’t randomly get new versions of something. Homebrew is just a nice way to install general OSX stuff you need/want in general.
pip and virtualenv are python libraries and can be installed in any working python install including the one supplied by Apple as part of OSX and the python.org version.
Then it depends on what you need from python - if you just have to install python libraries or simple C linraries then you can just use easy_install and then pip, vittualenv other python tools.
If you are using more complex C libraries e.g. python interface for mysql then it helps to use a package manager like macports, homebrew or fink as the port writers will have sorted out the tricky dependencies. There are also other python installs from Enthought and Activestate that deal with some of the non simple cases e.g. scipy but are not general purpose package managers.
Macports and fink will install a separate version of python in /opt/local/bin or /sw/bin whilst I think homebrew will use Apple's python. *The difference is due to a difference of view of the package mangers design. Macports and fink were developed by people who experienced a lot of issues with different versions of software and so said that all our installs will be in a place only the package manager uses whilst Homebrew trys to use as much of the Apple supplied tools as possible so to add as little as needed.

Django - Mac development, environment hell

I was trying to setup Django dev environment on Mac and arrived into a hell. It all started when trying to install PIL, which failed after trying 15 or so different recipes I found on blogs. So I wanted to install the Python, this time 2.7, and reinstall setuptools, easy_install, pip from scratch.
After just installing Python 2.7, and easy_install with setuptools for 2.7, this all in turn created such a mess that is unbelievable. Different version of Python are installed everywhere, easy_install is installed everywhere and points randomly to different python hashbangs (sometimes to #!/usr/bin, #!/usr/local/, #!/Library/...)
Now I can't even do easy_install pip, which I always could. So I'm already in a hell and I haven't even attempted to install MySQL yet.
My question finally is did anyone bump into such problems, it would help enough to know that I'm not alone.
Second, would it be easier to set up the entire environment on Ubuntu than it is on a Mac?
Thirdly, is there any guide that can really clearly explain how to set up but also tear down the stack for Python development on a Mac?
It wouldn't hurt to run a VM with vagrant. This post should tell you more:
http://stevelosh.com/blog/2011/06/django-advice/
Of course using virtualenv should also help alleviate some of these issues.
I've gone through the same hell 2 weeks ago :)
I needed to make working python 2.7 and virtualenv on OSX 10.6.8.
You haven't mentioned virtualenv in your question but I strongly recommend it. That way you minimize amount of globally installed packages. Everything is... cleaner.
My idea is to only have following things globally:
python (from brew)
pip (via easy_install)
virtualenv (via pip)
virtualenvwrapper (via pip)
other through either virtualenv or buildout
I've just checked and pip PIL installs fine within my virtualenv.
Here are notes from this battle (gist.github.com):
#NOTE: .pydistutils.cfg seems to be not compatible with brew install python
#areas I needed to clean before installation
#clean up ~/Library/Python
#clean up .local
brew install python
easy_install pip
pip install virtualenv
pip install virtualenvwrapper
mkdir $HOME/.virtualenvs
Example .bash_profile:
#homebrew
export PATH=/usr/local/bin:/usr/local/sbin:${PATH}
# homebrew python 2.7
export PATH="/usr/local/share/python:${PATH}"
#virtualenv wrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/share/python/virtualenvwrapper.sh
Good luck!
Second, would it be easier to set up
the entire environment on Ubuntu than
it is on a Mac?
To answer this question (though I never used Mac though): I never had problems setting up a python environment for Django development on Ubuntu. Though in any case you should go with the built-in Python version if possible. Attempting to install any other Python versions usually ends up messy. Luckily with Ubuntu 11.04 the standard version is already 2.7.
I'm using django development environment on a MAC OS X 10.8 with python 2.7. I don't use virtualenv ore some other things.
With all the respect can say that there is NO ANY PROBLEMS to develop on a mac. Mac is a UNIX like system and you've probably seen that all tools for developers have MAC ports.
As for the setup mess. It's a good idea to use virtualenv. As for PIL installation. I needed to compile it with TrueType. As I'm in common with UNIX like environments it was not heavy task for me to compile PIL from sources using GCC (it's already installed on a MAC)... There are some mess with Django to setup virtualenv... There are certainly lots of articles to setup it on Google.
I use Eclipse and write all my PYTHONPATH variables there. You can forget installing everything like in Linux and try not to make anymore mess with installed tools. Try to read THIS article if you feel like you're ok to use Eclipse for your development on a MAC. It also has a recipe to avoid mess with installation of many copies of Python and other dev utils.
Yes I have had problems with MacOS. I think rather than trying to figure it out I just switched to Ubuntu. I use a mac with Ubuntu installed in VMware Fusion. I have developed on both and prefer the Ubuntu because I'm just more comfortable with installing packages and the file structure.
I love using the VM because I'm never scared of having to start over. I can get a whole new OS installed and get the packages with what I use in just a few hours. Not to mention with 6month rollouts I can do complete installs of new versions instead of updates.
Depending on your production environment, it may be beneficial to use an OS that is similar, if you can install a package on ubuntu desktop, you already know how to do it on ubuntu server.

Python2.6 Backtrack/Ubuntu wxPython

I wrote a python app and it needs python2.6. I'm trying to get it to run in Backtrack 4 which is a pen-testing linux distro based on debian/ubuntu. I'v managed to install python2.6 along side of python2.5. Now I'm trying to install wxPython for 2.6 from the repos but I can't get it to install it for python2.6 rather than 2.5. Is there some way i can set a flag to specify what python installation to target? Or do I just need to install it from source?
There is pre-built version of python, wxwidgets, wxpython in ubuntu packages.
You don't need to build from the sources(unless you have special reasons), you can install it from the following links.
http://packages.ubuntu.com/jaunty/python2.6
http://packages.ubuntu.com/jaunty/libwxgtk2.8-0
http://packages.ubuntu.com/jaunty/python-wxgtk2.8
And also wxPython 2.8 is recommended, you still can find 2.6 though.

Categories

Resources