ModuleNotFoundError: using Spyder - module

6 Hours into trying to fix this i gave up.
Im just trying to import basic moduls that are installed on my MAC, i can run bs4, pandas etc etc on sublime, jupyter etc except SPYDER. The console outputs the following
File "<ipython-input-1-50b2309bcaa6>", line 1, in <module>
import bs4
ModuleNotFoundError: No module named 'bs4'
Things i have tried.
I changed the Nano file on mac so that Python = 'python3' and pip = 'pip3': Didn't work.
Changing the IPython console settings to Run a module: Worked for the module Request but the the other modules still fail (bs4,pandas,etcetc)
Restarting my computer 100 times: Didn't work
Googeling the shit out of it: Didn't work
Uppercutting the MAC: Didn't work

Related

ModuleNotFoundError: No module named 'seaborn' in spdyer

I recently installed spyder on my macbook (M1). I am getting module not found error when I tried to load seaborn.
Pl note
I am able to load the seaborn in jupyter notebook
Whey I change the python interpreter to the the one jupyter notebook is using (i.e. miniforge), I get following error
/Users/akbarboghani/miniforge3/bin/python: Error while finding module specification for 'spyder_kernels.console' (ModuleNotFoundError: No module named 'spyder_kernels')
Is there any setting I have missed? How do I resolve this
I tried changing preferences and restarted the spyder application. Checked for solution, did not find any.

Import does not function as bat file; but works in spyder

I am still not the most sophisticated python user; but I cannot overcome this probably simple problem. I have a code that works perfectly with the spyder interface. I would like to make it a recurring task via creating a bat file. The bat file which in turn triggers a cmd interface does not import pandas_data reader and the code gets stuck and aborts.
import pandas_datareader.data as web
this line above creates the error below. It's a lengthy text.
File "C:\Users\myself\anaconda3\lib\site-packages\pandas_datareader\__init__.py", line 2, in <module>
from .data import ( File "C:\Users\myself\anaconda3\lib\site-packages\pandas_datareader\data.py", line 9, in <module>
from pandas.util._decorators import deprecate_kwarg File "C:\Users\myself\anaconda3\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies) ImportError: Unable to import required dependencies: numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\Users\myself\anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.17.0" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.

How to fix matplotlib.pyplot problem in installed matplotlib in python

I am new in python and last month I have installed matplotlib module in my python and using that I have also done some codes successfully. But now suddenly I don't know why my matlpotlib module is not working. When I write "import matplotlib.pyplot as plt" it shows the error "ModuleNotFoundError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package" and the codes that was done before are also not working and showing the same error."import matplotlib" statement works properly in command prompt and IDLE. What am I suppose to do to solve this problem?

ModuleNotFoundError: No module named 'pandas.io' for json_normalize

Please read carefully. In my Python script I have the following:
import json
import pandas
from pandas.io.json import json_normalize
and it returns the following error:
from pandas.io.json import json_normalize ModuleNotFoundError: No
module named 'pandas.io'; 'pandas' is not a package
My steps:
I have uninstalled and installed Pandas
I have upgraded pip and pandas
I have installed io (pip install -U pandas.io)
I have installed data_reader and replaced the pandas.io.json part with that: from pandas_datareader import json_normalize
I have tried every solution I saw on stackoverflow and github and nothing worked. The only one I have not tried is installing Anaconda but it should work with what I tried before. Do you think it is a Windows setting things I must change?
PS: My Python version is 3.7.4
Try:
Go to ...\Lib\site-packages\pytrends on your local disk and open file request.py
Change
from pandas.io.json._normalize import nested_to_record
to
from pandas.io.json.normalize import nested_to_record
I had the same error, but it helped me.
also change
from pandas.io.json.normalize
to
from pandas.io.json._normalize
The cause of the problem was the fact that the python file had the name pandas. The filename was pandas.py. After renaming it, the code worked normally without errors.
i had same problem and i solve it b uninstalling extra python versions install on my windows.now i have only one python installed by anaconda,and everything is working perfectly

import matplotlib.pyplot crashes on jupyter notebook

I have a jupyter notebook running on a remote cluster to which I have set up an ssh tunnel. Everything was working fine till today. Now everytime I do :
import matplotlib # This works
%matplotlib inline # This causes kernel to restart
import matplotlib.pyplot # This also causes the kernel to restart
Running a standalone ipython interpreter and doing :
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot ## Leads to Core dumped : Segementation Fault
Running the same on a python interpreter works fine.
Jupyter version : 4.1.1
Python version : 2.7.7
Any help would be much appreciated.
Thank You
Often, this kind of error seems to be related to the backend. Have you tried any other backends? Do these result in the same error? Like this we could narrow down the source of the error.
(I don't have a remote cluster, so I can not reproduce it.)
You can find available backends as described here.
I perhaps have the same problem but on my local machine. I got into jupyter3-qtconsole 4.2.1 with Python 3.4.5 and IPython 5.0.0. and enter
`%matplotlib
Using matplotlib backend: Qt4Agg`
the error message (shortened):
File "/usr/lib64/python3.4/site-packages/tornado/ioloop.py", line 603, in _run_callback
ret = callback()
and finally
from IPython.core.interactiveshell import NoOpContext as context
ImportError: cannot import name 'NoOpContext'
Same thing happens in a notebook but in a straightforward IPython terminal, everything runs OK
Hope this is helpful to someone