Problems with using numpy libraries with anaconda environment on Ubuntu platform - numpy

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.

Related

Cannot import name 'to_html' from 'pandas_profiling.report' using JupyterLab

I'm new using Jupyter Lab and Pandas profiling.
I'm trying to install and import and install Pandas Profiling in a jupyter notebook. I'm able to install pandas collab using pip, but unable to import the library. The error says I cannot import name 'to_html' from 'pandas_profiling.report'.
Here's the code and the error.
Funny thing is: I also tried to run the notebook in Google Colab, but I got a different but similar error:
ImportError: cannot import name 'PandasProfiling' from 'pandas_profiling' (/usr/local/lib/python3.8/dist-packages/pandas_profiling/__init__.py)
I already tried to use Jupyter Lab and Jupyter Notebook from Anaconda and Google Colab to see if it works, but no look.
conda install -c conda-forge pandas-profiling
See this question.
from pandas_profiling import ProfileReport
https://pandas-profiling.ydata.ai/docs/master/pages/getting_started/quickstart.html
PandasProfiling object does not exist.

Installing extension

In shell I can't install numpy and it shows this error
The problem is that you are typing 'shell' (operating system) commands into the Python interpreter, which only understands Python.
First, exit the Python interpreter with exit().
Then type the shell command, pip install numpy.
Then you can re-enter the Python interpreter, e.g. by typing python and you should have access to NumPy with import numpy as np (for example).

ModuleNotFoundError: No module named 'numpy' AWS SageMaker Studio Lab

I installed the numpy with Conda, pip and pip3, also tried installing from the requirements.txt file but I am still getting the following issue. Has anyone encountered this before and could please kindly suggest something?
ModuleNotFoundError Traceback (most recent call last)
/tmp/ipykernel_732/1818554654.py in
1 import os
----> 2 import numpy as np
3 import matplotlib.pyplot as plt
4 import pandas as pd
5 import random
ModuleNotFoundError: No module named 'numpy'
numpy is built-in the default:Python environment in Studio Lab. If you open a new notebook with the File -> New -> Notebook, and choose the default:Python kernel, you should be able to import numpy without having to install the package.
If you would like to have a reproducible environment with a set of packages, see this sample repo on creating custom environments.
Numpy isn't preinstalled as a module you will need to install it yourself using pip or conda. Using notebooks just include a code block with the following:
!python -m pip install numpy
Suggestion to compile a list of required modules in a 'requirements.txt' file and install using:
!python -m pip install -r requirements.txt
Just as an FYI, the base package list is as follows:
Python 3.9 bzip2 build-essential curl git libgl1-mesa-glx nano rsync
unzip wget ca-certificates pip ipykernel-6.4
Have a look at this link for more info.
SageMaker - Manage your environment

How to make PyCharm recognise numpy

PyCharm does not see my numpy: thats what i got when Im trying - pip install numpy -
Requirement already satisfied: numpy in /Users/ruslanpilipyuk/opt/anaconda3/lib/python3.7/site-packages (1.18.1)
However, when I write import numpy,as a result I got -
ModuleNotFoundError: No module named 'numpy'
Im using mac
Whenever you import a module, python will search for that module in some specific directories. To know which all directories it will search, use the below given code in python prompt.
$ import sys
$ print(sys.path)
If your NumPy module does not present in any of those directory, then add your NumPy module to the python search path by the following given code in python prompt.
​
$ import sys
$ sys.path.append("/Users/ruslanpilipyuk/opt/anaconda3/lib/python3.7/site-packages (1.18.1)")
$ import NumPy
Hope this will solve your error.
Reference: https://www.edureka.co/community/66413/import-numpy-as-np-importerror-no-module-named-numpy

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