简体   繁体   中英

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. numpy-default-python-内核

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM