Can't install numpy in PyCharm - numpy

enter image description here
enter image description here
I can't install numpy via PyCharm and can import numpy in PyCharm but I did install numpy in IDLE. how can I solve it

Related

spyder ModuleNotFoundError: No module named 'sklearn'

This error is coming when i am trying to import Sklearn in Spyder IDE. But it is running smoothly on python 3.11 terminal if i am trying to install in by pip install Sklearn its showing:
enter image description here
on Spyder ide its showing :
enter image description here
This on importing sklearn.
on python3.11 it is not giving any error:enter image description here
how can I fix this issue?

ImportError: cannot import name 'to_categorical' from 'keras.utils

I have this code for training face, I already generated images for training face and put it in datasets folder, I complete the installation of some requirements as follows :
pip install -Iv tensorflow==2.8
pip install -Iv opencv-python==4.5.5.64
pip install --upgrade Pillow
conda install -c conda-forge dlib
pip install imutils
pip install -U scikit-learn
However, the error
ImportError: cannot import name 'to_categorical' from 'keras.utils' (C:\Users\TOSHIBA\anaconda3\envs\FR_DN\lib\site-packages\keras\utils\__init__.py)
still appears when run train code, I already read some problem and solution one is to use from tensorflow.keras.utils import to_categorical but it did not worked. Anyone have any idea to solve this issue?
import cv2
import numpy as np
from PIL import Image
import os
from tensorflow.keras.utils import to_categorical
If need to check the full code it is avaliable in this link Code

How to plot an image using PIL or Matplotlib

I am trying to plot an image in python using either PIL or Matplotlib. I have tried both
import matplotlib.pyplot as plt
and
from PIL import Image
But I get the same error:
ImportError: cannot import name '_imaging' from 'PIL'
I have updated pillow and matplotlib packages but no success
You can read the image using open cv and then plot it using matplotlib.
img_name = cv2.imread("image.jpeg")
plt.imshow(img_name)
plt.show()
This usually happens when folk use python and pip from different packages, distributions or versions. I mean you install a package with pip into one package/distribution/version and then try and use it from a different package/distribution/version of Python.
So, if you normally start Python using:
python
then run:
type python
Whereas if you normally start Python using:
python3
then run:
type python3
On my machine I get:
type python3
python3 is /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
so now I know which Python I am using.
Now you need to see which pip you are using. So, if you normally start pip with:
pip
then run:
type pip
Whereas if you normally start pip with:
pip3
then run:
type pip3
On my machine I get:
type pip3
pip3 is /Library/Frameworks/Python.framework/Versions/3.9/bin/pip3
So now you can see that my pip3 is installing packages for python3 exactly where it can find them.

Problems with using numpy libraries with anaconda environment on Ubuntu platform

I am working on the Ubuntu platform and have downloaded the numpy libraries using the following command in the terminal:
>> conda install -c anaconda numpy
and then tried to import the numpy library as np as follows:
>> import numpy as np
now this command gives out the "ModuleNotFoundError" as follows:
Output on the spyder console
I know it looks like a basic question but I'm learning.
Thank you.
You should first enter into the ipython console by 'ipython' command in terminal, then 'import numpy as np' will work.

i cant import numpy in pycharm and its showing errors even after running pip install numpy in cmd

even after trying pip install numpy in cmd i cannot get the numpy module installed in pycharm.
i have also tried to add numpy using project interpreter.
numpy is being listed in the available modules but it cannot be installed.
The screenshot of the error is placed below. please help me out