I want to draw a decision tree with python3. Yet I can only find modules for python2: graphviz, ete3
Did I miss something? Can I use them with python3? Do you know any other possibilities?
I use Ubuntu 14.04.
Edit:
I tried the command sudo python3 -m pip install graphviz, but it still can't find the module.
According to Graphviz's PyPI page, it is available for Python 3.
On Ubuntu make sure you have graphviz with:
sudo apt-get install python3-pygraphviz
Perhaps Python3 can't find your installed graphviz? Did you install it with, e.g.
python3 -m pip install graphviz
On Ubuntu you might try:
sudo apt-get install python3-pip
pip3 install graphviz
You haven't told us what your system is, which may affect the advice you are given.
If you're on Windows, I usually recommend installing Anaconda and using its package manager (it comes with almost all the things, but not graphviz so you'd have to use its package manager to install, but I'd expect it to work out of the gate once you did install it).
If you're on Mac or Linux, try installing with the command I gave above (or whatever your Python 3 executable uses.)
Related
I was trying to install Django. Turns out that course's teacher said that we will be working with Python 3.6
I install Python 3.6. Now it's my default, it somewhat replaced the last version I had; which is Python 3.5.
Everything ok until that. But when I want to install Django doing
"pip3 install django", it tells me that the module is already satisfied and therefore installed.
I run "python3" command into my terminal. It runs Python 3.6. I try to import Django, and boom... "No module named 'django'".
Then I realized pip3 was actually installing my modules into Python 3.5 and not 3.6. So what I do is to install pip in Python 3.6.
I download get-pip.py and proceed to execute it with Python 3.6 typing in "python3.6 get-pip.py".
Here is when the damn "zipimport.ZipImportError: can't decompress data; zlib not available" goes in. I've tried a ton of things and no one of them fixed the %^$! problem. I'm really tired.
What I have already tried:
python3.6 -m pip install django, which output is "/usr/local/bin/python3.6: No module named pip"
apt install zlib, which output is "E: Unable to locate package zlib"
apt install zlib1g-dev, which says that it's already installed; the problem persists though.
I also came across this problem (while creating a simple installer for pyenv). Here's how I solved it for Mac and Linux:
Ubuntu 20.04, 18.04
You need the zlib development files, and probably zlib itself too:
sudo apt install -y zlib1g-dev zlibc
If you're missing zlib, it's likely that the next problem you'll run into is with openssl, so it's probably best to get that now as well:
sudo apt install -y libssl-dev
sudo apt install -y libssl1.1 || sudo apt install -y libssl1.0
macOS
I believe this comes with XCode CLI Tools (or at least I didn't have to custom install it Big Sur):
xcode-select --install
For me it worked in RHEL:
$ yum install zlib-devel
Suggested solutions (installing zlib1g-dev or zlib-devel) seem to resolve the issue in most cases. Here is one edge case I've encountered recently: whatever you are trying to run might use zlib via symlink which might be broken.
In my case I was trying to run a build of a 3rd-party software which already had python and all necessary libs being emebedded into it. It was packaged as a tar.gz archive. Unpacking the archive on a Windows machine and then copying the contents to another linux machine destroyed all the symlinks (if you do ls -l in a folder with symlinks you would see that all of them have size 0 and do not point to anything). Copying tar.gz to the linux machine directly and unpacking it there resolved the issue.
P.S. I know it's an edge case scenario but it took me and one more developer quite a while to figure it out so I think it's worth mentioning here, just in case someone gets as unlucky as I got.
Its solves my issue for centos 7.6 :-
yum install zlib-deve
I'm trying to install NumPy, so that I can use it in Python plug-ins for GIMP. Every time I try, it installs into the external Python, and the Python inside GIMP can't find it. How do I install NumPy, so that GIMP can find it?
If you are using the flatpak version, you can install numpy as a "user" package using your "general" pip installer (and not the apt kind) and it will be taken in account by Gimp's built-in runtime (just tested, it works). You may have to force a specific version to get a V2-compatible numpy:
pip install --user -I numpy==1.11.0
I cannot tell you how to install pip for your V2 python on 20.04. On my 19.04 apt install python-pip did the trick but on 20.04 it could be apt install python2-pip or you would have to install it by hand.
I had pyhton2.7 and Python3.5 in my laptop but to use f string, I installed pyhton3.6.5 and removed python3.5. Now I have python2.7 and Python3.6.5. But I am not able to install any libraries for the python3.6.5
I have tried this but it doesn't works
Please let me know how can I install modules for the python3.6.5
Try this
sudo python3.6 -m pip install [Package_to_install]
I hope it will work.
Check the installation in your system, if there are several python3 installs in your system it might be an issue.
Either uninstall the other version of python3 or create a virtual environment and then install the library.
Check the description at https://www.alexkras.com/how-to-use-virtualenv-in-python-to-install-packages-locally/
I'm having problems while installing a new package in Python. I was looking for the termcolor package. I installed it using the apt:
sudo apt-get install python-termcolor
But when I try to use it in Python 3.6 it keep telling me that's not installed. I checked whether it was and I got:
cris#Manaos:~$ dpkg -L python-termcolor
/.
/usr
/usr/share
/usr/share/pyshared
/usr/share/pyshared/termcolor-1.1.0.egg-info
/usr/share/pyshared/termcolor.py
/usr/share/doc
/usr/share/doc/python-termcolor
/usr/share/doc/python-termcolor/README.rst
/usr/share/doc/python-termcolor/copyright
/usr/share/doc/python-termcolor/changelog.Debian.gz
/usr/share/doc/python-termcolor/CHANGES.rst
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/termcolor-1.1.0.egg-info
/usr/lib/python2.7/dist-packages/termcolor.py
So I understand that the package was correctly installed, but in the v2.7. How do I get it installed in the v3.6?
EDIT: I've read that if a use the pip installer, I could assign in which version of Python I'd like it installed, like using pip3 to install the package in 3.XX. But I tried it, it says that it was correctly installed and when I open Python 3.6 and try to use it, still got the ModuleNotFoundError.
EDIT2: After checking one more time, I discovered that with pip3 I installed the termcolor package in Python 3.5.3, but how can I get it installed in Python 3.6.1?
You need to specify you want the python 3 version.
sudo apt-get install python3-termcolor
As I have started to use Python 3.4, I need pip to maintain libraries on both Python 2.7 and Python 3.4.
How to select the appropriate pip quickly using terminal?
Note:
This question is NOT related to Virtualenv but with the default python2.7 and python3.4 that comes with Fedora 22 Workstation.
As a temporary fix, I am using PyCharm to manage libraries.
I never use pip install directly (when outside a venv, at least).
Instead I use python-<version> -m pip install --user <packages>, which always does what I really meant regardless of what version the wrapper scripts are for. This is especially useful if I've locally installed a newer version of pip.
Fedora separates Python 2.x and 3.x's environments. yum install python-pip will give you an executable called pip which you can use for Python 2.x packages, and yum install python3-pip will give you an executable called pip3for managing Python 3.x packages.
You can install either, both or neither - they will not interfere with each other.
I'm using Fedora 23 and I have the package python3-pip already installed but there's no pip3 nor python3-pip command in my path, so the way I've found to use pip3 is to invoke it through python3 executable:
python3 -mpip
For example, to install mps-youtube:
sudo python3 -mpip install mps-youtube
on fedora 25 you can just do the following:
copy file sudo cp /usr/bin/pip /usr/bin/pip3
then edit it to change #!/usr/bin/python to #!/usr/bin/python3
do pip3 -V to see that works.
this solution can also work on others version of fedora.