Installing the Minisom package in Pycharm - python

I'm following this tutorial to get a better grasp on the concept of SOM.
This however requires me to install the Minisom package.
If i try the normal way of installing a package in Pycharm
File->Settings->Project settings->Project interpreter
Press on the "+" sign
I don't get any hits on the term "minisom"/"Minisom".
Any thoughts on how else I can install this package?

Are you sure to have selected the right interpreter? because if I try the same steps, works well.
On the GitHub page you can see that the python versions which were been tested are 2.7.3 and 3.2.3. Are you using one of these two?
Anyway, an alternative way to install MiniSom is:
Download or clone the project following this link
Enter in the directory
run python setup.py install (may require root privileges)
Let me know.

Related

My VS Code dont recognize the pip packages

Despite im used to program stuff, im new in Python so i decide to learn by myself.
So, i install VS code and python. At the moment i tryied to use stuff like tensorflow, is showing an error saying that my imports are missing.
I've already tryed to install everything again, search for a solution online and nothing worked.
If someone knows anything about how to fix this i'd be greatfull.
Whether there are multiple versions of python in your environment, which will make the pip installed in one version of python instead of the python you are using.
Use shortcuts "Ctrl+shift+P" and type "Python: Select Interpreter" to choose the correct python. Then use pip install packagename to reinstall the package which you need.
Generally, we recommend people new to python to use the conda virtual environment.
Confirm you have downloaded python correctly:
Open terminal
Run python --version
(if that doesn't work try python3 --version

Packages installed via Pip do not get imported in Python VSCode [Windows 10]

Trying to install new packages via pip on Windows, but after it installs - Python cannot resolve the import. For Example, I have just installed the Python package similaritymeasures and pip correctly installed it, but when I import it into my Python program, it cannot find the import. Has anyone know a way around this?
Make sure that you restart VSCode after downloading your package. Sometimes, when you download a package while VSCode is still running, it doesn't recognize the package when using import similaritymeasures.
If that didn't work, then make sure that VSCode is using your preferred version of python. It is possible that you have more than one python version and it's using a non-compatible one to run your code. This can be done at the bottom right corner of the window by clicking the box that says: (for example) 3.9.5 64-bit. Then select a different (preferably older) version from the pop up widnow.
These are the solutions that came to my mind, I hope this helped.

problem installing and importing modules in python

I am installing python on windows10 and trying to install the opencv and numpy extentions in the command window. I get no error installing them and it says it is successfully installed. But when I try to check the installation and import cv2 it does not recognize it and give me the error: no module named cv2.
can anybody help me with this problem? Is there something wrong in installation process or do I need to install something else?
I checked the newest version of each and used the compatible one with my system.
Thanks.
One solution could be that you have 2 versions of python. So, go to the specific python's scripts directory and run: pip install numpy
If that too doesn't work, you can find the answers to this question on Why can't I import opencv3 even though the package is installed?, as stated by #Cut7er.
I have tried the solutions given to the above stated question myself also. But, they didn't work for me. So, another thing that you could try to use is this IDE called PyCharm. It ofcourse is much more beautiful that the IDLE, but it also has an inbuilt GUI controlled installation of binaries or packages. That would make things a lot easier. I have faced a lot of issues with packages for python and this IDE made things a lot easier. You can find it on https://www.jetbrains.com/pycharm/download/#section=windows.
You can also use anaconda. But, I found it a little difficult to use since, it has similar issues.
EDIT:
Seems like you are using PyCharm. But, you are installing libraries from your command prompt. So, see the answer to: ImportError: No module named 'bottle' - PyCharm. This answer guides you through how to install a certain library through your PyCharm window itself. So,
1) Go to Files>Settings
2) Search for "Interpreter" from the searching tab. Open the interpreter
3) You can now see a plus sign on the right. A click on it will open up a section on the left.
4) In the searching tab, search for numpy or opencv. Click on whichever module you want to install. And then click on the "install package" button on the bottom left. This will install the package for you.
5) Then click save. And run your file that says import cv/cv2.
This should probably do the trick.
Hope it helps!
Is it possible that you have 2 versions of python on your machine and your native pip is pointing to the other one? (e.g. you pip install opencv which installs opencv for python 2, but you are using python 3). If this is so, then use pip3 install opencv
I removed the Anaconda version on my machine, so I just have python 3.7 installed. I removed the python interpreter(Pycharm) and installed it again and the problem got fixed somehow!
I suspect you have two versions of python and the one you're using doesn't have opencv on it, because pip pointed to the wrong one.
A pragmatic solution assuming you're using the python version with conda is to just use conda to install cv2:
conda install -c menpo opencv
A more careful solution is to figure out how to get the pip that points to the python version you're using. On linux I can check that my pip points to my python like this:
:~$ which python
/home/kpierce/anaconda3/bin/python
:~$ which pip
/home/kpierce/anaconda3/bin/pip
So you see the pip and python versions are associated. On windows I suspect you do an analogous thing on the command line like
where python
where pip
And if they don't match, you might try
where python
where pip3
to see if those match. You need to use the pip that points to the correct python version. You can view the python version by entering the python interpreter and running
import sys
sys.version

Installing/Using Pillow on Python 3.6 and Visual Studio

Alright, I need some pointers. I am missing something. I am trying to use Pillow through Python 3.6. The platform I use is Visual Studio 2017. I can't get it to work.
I downloaded Pillow from this website:
https://pypi.org/project/Pillow/
And ran the installer.
According to my research, I need pip to install it; which comes built-in python 3.6. I have seen sign that it is actually installed through my module in visual studio (pip 9.0.3). I simply need to use the following line:
from pip.commands import install
and also tried
import pip
Now, according to this:
https://pillow.readthedocs.io/en/5.2.x/installation.html
All I have to do is
pip install Pillow
Though other sites indicate that PIL is still being used. I have tried both without success. Pillow is not recognized and a error comes in: invalid syntax.
I am clearly doing something wrong. I consulted some youtube tutorial; they all skip that part. They download then go straight to their coding platform and it works.
I can only guess I have additional steps to do with Visual Studio.
Also... The location of my files might be out of whack due to IT security on my work laptop. Could that be an issue?
You can do the following:
python -m pip install pillow
No need to downloade Pillow from the website.
After that, to use it you can do:
import PIL
Thanks for the feedback. I played with Visual Studio some more; there is a way of getting it straight from the menu.
I opened a Python 3.6 project/solution. On the "Python Environment" node in the solution explorer, I right clicked and created a virtual Python environment.
Then I right clicked on the virtual environment and selected "Install Python Package...".
You can then search the package you need for your project.
I don't know if this is the most efficient way. From my research, I think the package are only applicable to my virtual environment; I still have to test that out to make sure.
I may have gone the long way around, but writing the proposed code did not work out. I am sure it works, but I am thinking I might not be using it in the right location.
Anyway, thanks for the help!

Python 3.4 - Installing Kivy Error

I'm trying to install Kivy on Python 3.4 using the instructions here: https://kivy.org/docs/installation/installation-windows.html
I'm on the installing dependencies step, where it gives me this error: http://prntscr.com/a5rk5k
Initially I tried just going ahead to the last step (python -m pip install kivy) and it looked like it worked fine, but then I tried import kivy in a Visual Studio project and it said "Unable to resolve "kivy""
Any ideas anyone? Keep in mind, I had Python 3.5 installed (which kivy does not work with) before now and set to default, but I changed the path in the command prompt.
Something is not right with your kivy installation, use python -m pip list to check what packages are missing and (re)install them, one-by-one would be the best for debugging. And also you've pasted it wrong, so the kivy.deps.gstreamer was read as a separate comand and not a package for pip
For simple installing of kivy just follow the install docs or if you don't mind having another folder or reinstalling python for new kivy&python try KivyInstaller which hopefully makes the whole process beginnerproof. You enter what you need in the beginning and then wait.

Categories

Resources