nltk_contrib for python latest version (python version > 3) - python

I have installed python 3.5 and NLTK. Also, I have installed the nltk_contrib library from https://github.com/nltk/nltk_contrib which is not supporting to the latest version of python. The error is that the library written for older version. So, the library has print without parenthesis which will not support to the latest version of Python.
Is there any latest version nltk_contrib without down grade the python?
Thanks in advance.

nltk contrib has not been ported to python 3 yet.
See this answer for more details:
How to install nltk_contrib in Anaconda
You need to figure out which part of the code you need for python 3 and either port it yourself.
Or set up a virtualenv or and env for anaconda with python 2.7 and use it there.
http://conda.pydata.org/docs/using/envs.html

Related

Modules installed but not found by Python in Raspberry Pi 3

I have a Raspberry Pi 3 with Raspbian and I upgraded python version from 3.7 to 3.8. If I type python --version in the terminal the correct version appears as the system version. However none of the modules that I have installed AFTER the version change seem to work. Python gives ModuleNotFoundError when trying to import ANY of the modules that I have installed.
I can see the modules with pip freeze but Python seems to not be able to find them.
I followed this instructions to purge 3.7. I reinstalled pip after purging python 3.7 but pip as again installed in /home/pi/.local/lib/python3.7/site-packages/pip. How can I get rid of 3.7 completely?
python3.8 -m pip install SomePackage # specifically Python 3.8 should work.
More documentation here: https://docs.python.org/3/installing/index.html#work-with-multiple-versions-of-python-installed-in-parallel
Just to summarize the comments and suggestions from other answers:
The problem I have was caused by the fact that even I had set Python 3.8 as default and python -v was pointing to Python 3.8 the pip script was installing modules for Python 3.7.
The suggested solution was to use pip3.8 (or whatever version someone might have) to install packages for that equivalent Python version and that works good.
Ideally best option if someone wants to have multiple versions of python is to use pyenv. You can create multiple virtual environments with multiple python versions.
However Do not uninstall the default Python. I have also tried to uninstall the default Python 3.7 to avoid having two versions of python 3 and keeping track of which module is installed where. This was a bad idea. I did not know that many Linux distributions have applications which use the default Python. You might get a black screen and who knows what other problems see this discussion Removed Python 3 on 18.04, how can I fix my system?

How to install Python 2 on macOS 12.3+

macOS 12.3 update drops Python 2 and replaces it with version 3:
https://developer.apple.com/documentation/macos-release-notes/macos-12_3-release-notes
Python
Deprecations
Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead. (39795874)
I understand we need to migrate to version 3, but in the meantime we still need version 2. Homebrew does not seem to have it anymore:
brew install python#2.7
Warning: No available formula with the name "python#2.7". Did you mean python#3.7, python#3.9, python#3.8, python#3.10 or python-yq?
brew install python2
Warning: No available formula with the name "python2". Did you mean ipython, bpython, jython or cython?
What gives?
You can get any Python release, including the last Python 2, from the official download site:
https://www.python.org/downloads/release/python-2718/ → macOS 64-bit installer
A bit more relevant information. It was removed due to the fact that macOS remove the support of python2, and there is an open issue to remove all the python2 formulae as well.
Instead of using python official installer, I would suggest using pyenv, which is easier to manage multiple python versions in your local.

Can the latest Anaconda package for Python 3.6 work for Python 3.5?

I have the 3.5 version of python. I want to install Anaconda, but it says on the Anaconda website the latest version of it is for Python 3.6. My question is could I still use the packages for Python 3.5, or should I install Python 3.6?
When you install Anaconda Python, it installs into its own area and wouldn't conflict with an existing Python installation. If you already have additional Python packages installed, you will need to reinstall them for the new Python installation, preferably using a Python virtual environment. You can't use a Python virtual environment from an existing Python installation and would need to create a new one against Anaconda Python if already using one.
If your own personal code works with Python 3.5, it likely will work with Python 3.6 no problems.
So with the above caveats on re-installing additional Python packages, there shouldn't be any reason why you couldn't use Anaconda Python 3.6.
I had the same problem where I couldn't run anaconda with python 3.6. What I did was to install anaconda with python 3.5. Go to https://repo.continuum.io/archive/ then download Anaconda3-4.2.0-Windows-x86_64.

SFrame for Python 3.4

On the project's website it tells me, that there is Python 3.4 support (Readme.md, which is shown as text on that page). However, I fail to see where I could get that Python 3.4 compatible version of SFrame from. It's not on anaconda and not on PyPI, where I only see Python 2.7 versions.
So I wonder, if they simply didn't update their Readme.md to note the fact, that SFrame is not available for Python 3.4 anymore, or if it is somewhere, where I didn't find it. Why should they note that there is no support for Python 3.5.x yet after all, if they didn't have it for 3.4.
I did install it for a Python 3.4.5 anaconda environment before and if I recall correctly, that was from PyPI, so I am thinking they took it down from there for some reason.
Does anyone know how to get a Python 3.4 compatible version of SFrame into an anaconda environment today?

Installing Shogun toolbox with MacPorts for Python 2.7

I am having a hard time trying to install the Shogun machine-learning toolbox via MacPorts. It seems that the only version MacPorts has declares Python 2.6 as a dependency and as a result MacPorts downloads and installs Python 2.6, numPy for Python 2.6 etc. The problem is I have Python 2.7 already installed and a host of other packages, including numPy, that I want to use with shogun already installed under Python 2.7.
Has anyone had success using shogun with Python 2.7. I couldn't find any documentation stating it only works with 2.6, so I assume 2.7 should work.
It looks like it needs to be converted to a python Portgroup port where the python version is implied from the current python see py-scipy for an example depending on py-numpy.
Also see the current threads on the macports mailing list for octave.

Categories

Resources