How to check that scikit learn is installed in your system? [duplicate] - python-2.7

This question already has answers here:
how to check which version of nltk, scikit learn installed?
(10 answers)
Closed 4 years ago.
I have Scikit-Learn installed on my system. How can I check its version and its availability in my system?

This seems like a duplicate of this question
As mentioned there you can do this from a Python REPL:
import sklearn
print(sklearn.__version__)
If scikit-learn is not found on your system, you will get an ImportError: No module named sklearn. If scikit-learn was installed inside a virtualenv, you will need to make sure it is activated via source bin/activate from the virtualenv root directory.

Related

Django projects fail on Ubuntu 20.04 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I just upgraded Ubuntu from 18.04 to 20.04, and ALL my Django projects (tens of them) were not working.
One of the problem related to psycopg2 when executing pip:
For example, there is "psycopg2==2.7.3.1" in my "requirements.txt" file, and running "pip install -r requirements.txt" resulted in errors when building wheel for psycopg2.
Change "psycopg2==2.7.3.1" to ""psycopg2-binary" solved the problem.
So, is such change necessary for all projects running on Ubuntu 20.04?
Other error examples from various projects when running server:
RuntimeError: __class__ not set defining 'AbstractBaseUser' as <class 'django.contrib.auth.base_user.AbstractBaseUser'>. Was __classcell__ propagated to type.__new__?
SyntaxError: Generator expression must be parenthesized (widgets.py, line 151)
AssertionError: SRE module mismatch
ModuleNotFoundError: No module named 'decimal'
... etc.
How to I fix these problems? I've been in a headache for weeks.
Your problem with psycopg2 is apparently due to an incompatibility between python 3.8 and older versions of psycopg2. (Issue #854)
The problem has been fixed, but it was not backported to the release that you are using. It has however been backported to the binary psycopg2 releases in various Linux distros.
So ... yes ... you are going to have to make some changes for all of your Django projects that use psycopg2 to get them to run on vanilla Ubuntu 20.04.
However, it looks like there are at least 3 ways to "fix" this:
Change to the "binary" package as you have done.
Change the psycopg2 version in your "requirements.txt" to 2.8.6 or later1.
Build, install and use python 3.7 or earlier. (Probably a bad idea in this case.)
1 - Or maybe 2.8.0_BETA2 or later because it looks like the fix has been backported that far in the source code repo. It depends on whether the patched releases were uploaded to PyPi ... which I didn't check. But all things being equal, updating to the most recent compatible version is preferable.

pg_config executable not found using django-redshift-backend [duplicate]

This question already has answers here:
pg_config executable not found
(54 answers)
Closed 3 years ago.
I am having trouble installing redshift on my django app.
When I am running
pip3 install django-redshift-backend
I get the error pg_config executable not found. My version of pip is 9.0.1 and I don't know why I'm having this error.
Can you help me on this?
I solved this problem by reinstalling libpq-dev.
It may help people facing the same issue.

Installing Tensorflow for Python 2.7 for Keras and CoreML conversion on Windows 10

I am currently working on an artificial neural network model with Keras for image recognition and I want to convert it using CoreML.
Unfortunately, I have been working with Python3 and CoreML only works with Python 2.7 at the moment. Moreover, Tensorflow for Python 2.7 does not seem to be supported by Windows... So my only hope is to find a way to install it.
I saw some tips using Docker Toolbox but I did not catch it and I failed when trying this solution, even though it looks like the only thing that works.
So, is there any quite simple way to install Tensorflow for Python 2.7 on Windows 10?
Thank you very much!
A non-optimal solution (the only one I found) in my opinion, is to install a Linux virtual machine. I used VitualBox for it.
Then, it is very easy to download Anaconda and Python 2, as well as the right versions of the packages. For example, you can download Tensorflow 1.1.0 using the following command $ pip install -I tensorflow==1.1.0.

Mac OSX Upgrade now Django Not Found [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have been using an outdated Mac operating system (10.5.8), but recently updated to 10.8. However, now django isn't being found anymore.
Operations such as:
python manage.py runserver
that worked before now return:
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
I read another post here where the user suggested checking if django was available using python -c 'import django'. Django is not available using that command, and I tried to modify my PYTHONPATH to point to where the django package was (in my Downloads folder), but that didn't work either.
Anyways, I'm confused as to why it worked before but not now? Maybe because this version of OSX uses a different version of Python?
PS I am not using a virtualenv. Thanks for any ideas!
I think when you upgraded to Mac OS X 10.8 your site-packages/ libraries were removed and now it sounds like you just need to install django again. Make pip install django.
Besides usage of virtualenv is a good practice to follow. In that particular case your virtualenv contained all necessary packages and you just had to install virtualenv instead of a bunch of libraries.
When you upgraded OSX, you almost certainly got a new default version of Python. 10.5 had Python 2.5, but 10.8 has 2.7. Libraries are installed for a specific version, so you'll just need to reinstall with the new version.

How to install cocos3d? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to Install Cocos3D for iPhone/iPad ?
I have already install cocos2d template.How to install cocos 3d template?
I suggest you head to this link: http://www.learn-cocos2d.com/2011/04/cocos2d-installer-updated-added-cocos3d/ there you can download an installer that will install cocos3d and cocos2d + all templates. Just follow the instructions provided. The installer was created by Steffen Itterheimer, he'll be happy if you leave some feedback ;)