Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Can't import a installed package in Python with jupyter notebook

$
0
0

I have a strange problem. I want to use the package "copulas" in Python (https://sdv.dev/Copulas/). For that I first install it by using

!pip install copulas

The output is

Requirement already satisfied: copulas in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (0.10.0)Requirement already satisfied: plotly<6,>=5.10.0 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from copulas) (5.19.0)Requirement already satisfied: numpy<2,>=1.23.3 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from copulas) (1.26.4)Requirement already satisfied: scipy<2,>=1.9.2 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from copulas) (1.12.0)Requirement already satisfied: pandas>=1.5.0 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from copulas) (2.2.0)Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from pandas>=1.5.0->copulas) (2.8.2)Requirement already satisfied: pytz>=2020.1 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from pandas>=1.5.0->copulas) (2024.1)Requirement already satisfied: tzdata>=2022.7 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from pandas>=1.5.0->copulas) (2024.1)Requirement already satisfied: tenacity>=6.2.0 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from plotly<6,>=5.10.0->copulas) (8.2.3)Requirement already satisfied: packaging in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from plotly<6,>=5.10.0->copulas) (23.2)Requirement already satisfied: six>=1.5 in c:\users\wi9632\appdata\local\programs\python\python311\lib\site-packages (from python-dateutil>=2.8.2->pandas>=1.5.0->copulas) (1.16.0)[notice] A new release of pip available: 22.3.1 -> 24.0[notice] To update, run: python.exe -m pip install --upgrade pip

Then I check if it was installed by using the following code:

!python --version!pip list

Which leads to the output:

Python 3.11.3Package         Version--------------- -------copula          0.0.4copulas         0.10.0numpy           1.26.4packaging       23.2pandas          2.2.0pip             22.3.1plotly          5.19.0python-dateutil 2.8.2pytz            2024.1scipy           1.12.0setuptools      65.5.0six             1.16.0tenacity        8.2.3tzdata          2024.1[notice] A new release of pip available: 22.3.1 -> 24.0[notice] To update, run: python.exe -m pip install --upgrade pip

When I then try to import the module by using the code:

# import all relevant librariesimport scipy.stats as statsimport numpy as npimport pandas as pdimport datetime as dtimport refrom matplotlib import pyplot as pltimport pickleimport copulas

I get the error:

ModuleNotFoundError                       Traceback (most recent call last)<ipython-input-8-cec22cbc11bb> in <module>      7 from matplotlib import pyplot as plt      8 import pickle----> 9 import copulasModuleNotFoundError: No module named 'copulas'

Here are some additional information:

import sysprint(sys.path)

leads to the output:

['C:\\Users\\wi9632\\bwSyncShare3\\Eigene Arbeit\\Code\\Python\\lademodellierung-main', 'c:\\users\\wi9632\\python\\python39\\python39.zip', 'c:\\users\\wi9632\\python\\python39\\DLLs', 'c:\\users\\wi9632\\python\\python39\\lib', 'c:\\users\\wi9632\\python\\python39', '', 'c:\\users\\wi9632\\python\\python39\\lib\\site-packages', 'c:\\users\\wi9632\\python\\python39\\lib\\site-packages\\win32', 'c:\\users\\wi9632\\python\\python39\\lib\\site-packages\\win32\\lib', 'c:\\users\\wi9632\\python\\python39\\lib\\site-packages\\Pythonwin', 'c:\\users\\wi9632\\python\\python39\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\wi9632\\.ipython']

and

import syssys.executable

Leads to the output:

'c:\\users\\wi9632\\python\\python39\\python.exe'

Can you tell me, why I can install the library but not import it?


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>