Error in importing pandas in jupyter notebook - python

I am using Ubuntu 18.04.
Whenever I try to import pandas in Jupyter Notebook, I get this error.
I have tried several ways to resolve this issue available on internet.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-7dd3504c366f> in <module>
----> 1 import pandas as pd
ModuleNotFoundError: No module named 'pandas'
I also got error while installing pandas in Jupyter notebook:
Building wheels for collected packages: pandas
Building wheel for pandas (PEP 517) ... error
ERROR: Complete output from command /snap/jupyter/6/bin/python /snap/jupyter/6/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpecqq53bt:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-37
creating build/lib.linux-x86_64-cpython-37/pandas
copying pandas/_version.py -> build/lib.linux-x86_64-cpython-37/pandas
check.warn(importable)
error: command 'gcc' failed: No such file or directory: 'gcc'
----------------------------------------
ERROR: Failed building wheel for pandas
Running setup.py clean for pandas
Failed to build pandas
ERROR: Could not build wheels for pandas which use PEP 517 and cannot be installed directly
I try to install pandas using ubuntu terminal but got these warnings.
pip3 install pandas
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pandas in ./.local/lib/python3.6/site-packages (1.1.5)
Requirement already satisfied: pytz>=2017.2 in ./.local/lib/python3.6/site-packages (from pandas) (2022.4)
Requirement already satisfied: numpy>=1.15.4 in ./.local/lib/python3.6/site-packages (from pandas) (1.19.3)
Requirement already satisfied: python-dateutil>=2.7.3 in ./.local/lib/python3.6/site-packages (from pandas) (2.8.2)
Requirement already satisfied: six>=1.5 in ./.local/lib/python3.6/site-packages (from python-dateutil>=2.7.3->pandas) (1.16.0)

Related

Error when installing python package ml-insights [duplicate]

This question already has answers here:
Error "Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)"
(36 answers)
Error while installing lxml through pip: Microsoft Visual C++ 14.0 is required
(8 answers)
Pip error: Microsoft Visual C++ 14.0 is required
(13 answers)
Pip error even Microsoft Visual C++ 14.0 is installed
(4 answers)
How to solve "error: Microsoft Visual C++ 14.0 or greater is required" when installing Python packages?
(9 answers)
Closed 3 months ago.
When I try to install ml-insights (referred to as ml_insights sometimes) using pip install ml-insights (https://pypi.org/project/ml-insights/), I get the following error (I use pyhton 3.8.5)
Collecting ml-insights
Using cached ml_insights-1.0.1-py2.py3-none-any.whl (36 kB)
Requirement already satisfied: matplotlib>=2.0.0 in c:\users\micha\documents\odsp\lib\site-packages (from ml-insights) (3.5.1)
Requirement already satisfied: scikit-learn>=0.24.2 in c:\users\micha\documents\odsp\lib\site-packages (from ml-insights) (1.0.2)
Requirement already satisfied: scipy>=1.6.0 in c:\users\micha\documents\odsp\lib\site-packages (from ml-insights) (1.8.0)
Requirement already satisfied: pandas>=0.23 in c:\users\micha\documents\odsp\lib\site-packages (from ml-insights) (1.4.2)
Requirement already satisfied: numpy>=1.16.0 in c:\users\micha\documents\odsp\lib\site-packages (from ml-insights) (1.22.3)
Collecting splinecalib>=0.0.2
Using cached splinecalib-0.0.3.tar.gz (56 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\micha\documents\odsp\lib\site-packages (from matplotlib>=2.0.0->ml-insights) (3.0.8)
Requirement already satisfied: packaging>=20.0 in c:\users\micha\documents\odsp\lib\site-packages (from matplotlib>=2.0.0->ml-insights) (21.3)
Requirement already satisfied: cycler>=0.10 in c:\users\micha\documents\odsp\lib\site-packages (from matplotlib>=2.0.0->ml-insights) (0.11.0)
Requirement already satisfied: pillow>=6.2.0 in c:\users\micha\documents\odsp\lib\site-packages (from matplotlib>=2.0.0->ml-insights) (9.1.0)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\micha\documents\odsp\lib\site-packages (from matplotlib>=2.0.0->ml-insights) (4.33.2)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\micha\documents\odsp\lib\site-packages (from matplotlib>=2.0.0->ml-insights) (2.8.2)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\micha\documents\odsp\lib\site-packages (from matplotlib>=2.0.0->ml-insights) (1.4.2)
Requirement already satisfied: pytz>=2020.1 in c:\users\micha\documents\odsp\lib\site-packages (from pandas>=0.23->ml-insights) (2022.1)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\micha\documents\odsp\lib\site-packages (from scikit-learn>=0.24.2->ml-insights) (3.1.0)
Requirement already satisfied: joblib>=0.11 in c:\users\micha\documents\odsp\lib\site-packages (from scikit-learn>=0.24.2->ml-insights) (1.1.0)
Requirement already satisfied: six>=1.5 in c:\users\micha\documents\odsp\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.0.0->ml-insights) (1.16.0)
Building wheels for collected packages: splinecalib
Building wheel for splinecalib (setup.py): started
Building wheel for splinecalib (setup.py): finished with status 'error'
Running setup.py clean for splinecalib
Failed to build splinecalib
Installing collected packages: splinecalib, ml-insights
Running setup.py install for splinecalib: started
Running setup.py install for splinecalib: finished with status 'error'
error: subprocess-exited-with-error
python setup.py bdist_wheel did not run successfully.
exit code: 1
[14 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-38
creating build\lib.win-amd64-cpython-38\splinecalib
copying splinecalib\calib_utils.py -> build\lib.win-amd64-cpython-38\splinecalib
copying splinecalib\splinecalib.py -> build\lib.win-amd64-cpython-38\splinecalib
copying splinecalib\__init__.py -> build\lib.win-amd64-cpython-38\splinecalib
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building 'loss_fun_c' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for splinecalib
error: subprocess-exited-with-error
Running setup.py install for splinecalib did not run successfully.
exit code: 1
[16 lines of output]
running install
C:\Users\micha\Documents\Odsp\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-38
creating build\lib.win-amd64-cpython-38\splinecalib
copying splinecalib\calib_utils.py -> build\lib.win-amd64-cpython-38\splinecalib
copying splinecalib\splinecalib.py -> build\lib.win-amd64-cpython-38\splinecalib
copying splinecalib\__init__.py -> build\lib.win-amd64-cpython-38\splinecalib
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building 'loss_fun_c' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
Encountered error while trying to install package.
splinecalib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Problems installing certain libraries in python using pip in Spyder

I’ve been running into the same error message with multiple libraries, not all libraries but randomly.
All I could find here and on other equation boards was that I need to upgrade my pip, it’s upgraded to the max (22.1.2) but I still get the same error, no with the added “WARNING: There was an error checking the latest version of pip.”
So this is what I get when I try to install pyinstaller
pip install pyinstaller
Collecting pyinstaller
Using cached pyinstaller-5.1-py3-none-win_amd64.whl (1.2 MB)
Collecting pefile>=2017.8.1
Using cached pefile-2022.5.30.tar.gz (72 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: pywin32-ctypes>=0.2.0 in d:\program files\spyder\pkgs (from pyinstaller) (0.2.0)
Requirement already satisfied: setuptools in d:\program files\spyder\pkgs (from pyinstaller) (61.2.0)
Collecting altgraph
Using cached altgraph-0.17.2-py2.py3-none-any.whl (21 kB)
Collecting pyinstaller-hooks-contrib>=2021.4
Using cached pyinstaller_hooks_contrib-2022.6-py2.py3-none-any.whl (231 kB)
Collecting future
Using cached future-0.18.2.tar.gz (829 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\tomer\AppData\Local\Temp\pip-install-01zbu624\future_a521b799a85941e08b0fd94b59c7d89a\setup.py", line 86, in <module>
import src.future
ModuleNotFoundError: No module named 'src'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: There was an error checking the latest version of pip.
Thank you for your help

Import excel2img gives ModuleNotFoundError

After I did pip install excel2img , I am trying to run import excel2img but getting
'ModuleNotFoundError: No module named 'excel2img' .
The python version that I am running is 3.8.5
even tried pip install pypiwin32 based on the error that I received while installing excel2img but of no help
Any help?
More info on error message
Collecting excel2img
Using cached excel2img-1.4.0.tar.gz (24 kB)
Requirement already satisfied: Pillow>=3.3.1 in /Applications/anaconda3/lib/python3.8/site-packages (from excel2img) (8.0.1)
Collecting pypiwin32
Using cached pypiwin32-223-py3-none-any.whl (1.7 kB)
ERROR: Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32->excel2img) (from versions: none)
ERROR: No matching distribution found for pywin32>=223 (from pypiwin32->excel2img)```

how to install geoviews in python?

i was trying to install geoviews using pip but got errors.
C:\Users\jainil>pip install geoviews==1.6.2
Collecting geoviews==1.6.2
Using cached https://files.pythonhosted.org/packages/5d/76/7aa62a5dfdec25ab9f921223bd26507bb603bc5f08a4a7057d3f5e24f42b/geoviews-1.6.2-py2.py3-none-any.whl
Requirement already satisfied: numpy>=1.0 in c:\users\jainil\anaconda3\lib\site-packages (from geoviews==1.6.2) (1.16.4)
Requirement already satisfied: holoviews>=1.11.1 in c:\users\jainil\anaconda3\lib\site-packages (from geoviews==1.6.2) (1.12.3)
Requirement already satisfied: bokeh>=1.0.0 in c:\users\jainil\anaconda3\lib\site-packages (from geoviews==1.6.2) (1.2.0)
Collecting cartopy>=0.16.0 (from geoviews==1.6.2)
Using cached https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Complete output from command 'C:\Users\jainil\Anaconda3\python.exe' 'C:\Users\jainil\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\jainil\AppData\Local\Temp\tmp25d9ovmd':
ERROR: setup.py:171: UserWarning: Unable to determine GEOS version. Ensure you have 3.3.3 or later installed, or installation may fail.
'.'.join(str(v) for v in GEOS_MIN_VERSION), ))
Proj 4.9.0 must be installed.
----------------------------------------
ERROR: Command "'C:\Users\jainil\Anaconda3\python.exe' 'C:\Users\jainil\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\jainil\AppData\Local\Temp\tmp25d9ovmd'" failed with error code 1 in C:\Users\jainil\AppData\Local\Temp\pip-install-sjcurctz\cartopy
ok it is solved.
solved by conda install -c scitools cartopy

pip not installing all dependencies in setup.py [duplicate]

When running my module directly with as a flask app through Docker with Python 3, which installs pandas based on the requirements.txt file, it runs fine. When I import this module from another app, it doesn't find pandas. The following is my setup.py file.
from setuptools import setup, find_packages
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='g_plotter',
packages=find_packages(),
#packages=['g_plotter', 'pandas'],
include_package_data=True,
""" install_requires=[
'flask',
], """
install_requires=required,
)
Failure at:
import pandas as pd
Traceback
server_1 | File "./g_server.py", line 21, in <module>
server_1 | from g_plotter import Gparser
server_1 | File "/usr/local/lib/python3.7/site-packages/g_plotter/Gparser.py", line 4, in <module>
server_1 | import pandas as pd
server_1 | ModuleNotFoundError: No module named 'pandas'
In Docker I don't see pandas being installed:
Step 12/15 : RUN pip3 install ./g_plotter
---> Running in 7cc0957f23e6
Processing ./g_plotter
Requirement already satisfied: flask in /usr/local/lib/python3.7/site-packages (from g-plotter==0.0.0) (1.0.2)
Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python3.7/site-packages (from flask->g-plotter==0.0.0) (1.1.0)
Requirement already satisfied: Jinja2>=2.10 in /usr/local/lib/python3.7/site-packages (from flask->g-plotter==0.0.0) (2.10)
Requirement already satisfied: Werkzeug>=0.14 in /usr/local/lib/python3.7/site-packages (from flask->g-plotter==0.0.0) (0.14.1)
Requirement already satisfied: click>=5.1 in /usr/local/lib/python3.7/site-packages (from flask->g-plotter==0.0.0) (7.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/site-packages (from Jinja2>=2.10->flask->g-plotter==0.0.0) (1.1.0)
Building wheels for collected packages: g-plotter
Running setup.py bdist_wheel for g-plotter: started
Running setup.py bdist_wheel for g-plotter: finished with status 'done'
Stored in directory: /tmp/pip-ephem-wheel-cache-iu6t3zln/wheels/a5/fc/d6/bbda9e5e615cade7b93e6d32cfba9062e2b21ea5352d0c2be0
The problem was that I had two setup.py files. One at the root and one in the subdirectory with the rest of the code. I was updating the inner one. Once I move that up and replaced the old one, all the dependencies got installed.

Categories

Resources