My python program runs when I go to the terminal and type
activate base
python data_load.py
This is where python is located:
where python
C:\ProgramData\Anaconda3\python.exe
Then I try to use PyCharm with Anaconda and I go to Settings > Project Interpreter > Add Local > Conda Environment > Existing Environment and C:\ProgramData\Anaconda3\python.exe as the interpreter. When I click the run button data_load.py does not run properly and there is a runtime error saying this:
Traceback (most recent call last):
File "C:/Users/Anonymous/PycharmProjects/pytorchHelloWorld/data_load.py",
line 4, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py",
line 42, in <module>
from pandas.core.api import *
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\api.py",
line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py", line 66, in <module>
from pandas.core.generic import NDFrame, _shared_docs
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py", line 43, in <module>
from pandas.core.internals import BlockManager
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\internals.py", line 76, in <module>
from pandas.core.sparse.array import _maybe_to_sparse, SparseArray
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\sparse\array.py", line 33, in <module>
import pandas._libs.sparse as splib
File "pandas\_libs\sparse.pyx", line 17, in init pandas._libs.sparse
AttributeError: module 'numpy' has no attribute 'version'
You need to create a PyCharm Enviornment.
Step 1:
Step 2:
Related
I'm trying to install Ryu controller on Ubuntu which I installed on my laptop. I don't understand where my mistake lies
Traceback (most recent call last):
File "/home/jeo/.local/bin/ryu-manager", line 5, in <module>
from ryu.cmd.manager import main
File "/home/jeo/.local/lib/python3.10/site-packages/ryu/cmd/manager.py", line 22, in <module>
from ryu.lib import hub
File "/home/jeo/.local/lib/python3.10/site-packages/ryu/lib/hub.py", line 30, in <module>
import eventlet
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/__init__.py", line 17, in <module>
from eventlet import convenience
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/convenience.py", line 7, in <module>
from eventlet.green import socket
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/green/socket.py", line 4, in <module>
__import__('eventlet.green._socket_nodns')
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/green/_socket_nodns.py", line 11, in <module>
from eventlet import greenio
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/greenio/__init__.py", line 3, in <module>
from eventlet.greenio.base import * # noqa
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/greenio/base.py", line 32, in <module>
socket_timeout = eventlet.timeout.wrap_is_timeout(socket.timeout)
File "/home/jeo/.local/lib/python3.10/site-packages/eventlet/timeout.py", line 166, in wrap_is_timeout
base.is_timeout = property(lambda _: True)
TypeError: cannot set 'is_timeout' attribute of immutable type 'TimeoutError'
This could be due to the python version installed in your system. Try downgrading to a lower version between 2.7 and 3.7 if you are using one of the newer ones.
When I run a python script in Pycharm it works perfectly. When I try to run it via the command line it errors:
C:\Users\Administrator\anaconda3\python.exe "C:\Users\Administrator\Desktop\Scripts\KD.py"
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\Scripts\Kariba_Dwell.py", line 10, in <module>
import s3fs
File "C:\Users\Administrator\anaconda3\lib\site-packages\s3fs\__init__.py", line 1, in <module>
from .core import S3FileSystem, S3File
File "C:\Users\Administrator\anaconda3\lib\site-packages\s3fs\core.py", line 15, in <module>
import botocore.session
File "C:\Users\Administrator\anaconda3\lib\site-packages\botocore\session.py", line 30, in <module>
import botocore.credentials
File "C:\Users\Administrator\anaconda3\lib\site-packages\botocore\credentials.py", line 42, in <module>
from botocore.utils import InstanceMetadataFetcher, parse_key_val_file
File "C:\Users\Administrator\anaconda3\lib\site-packages\botocore\utils.py", line 31, in <module>
import botocore.httpsession
File "C:\Users\Administrator\anaconda3\lib\site-packages\botocore\httpsession.py", line 7, in <module>
from urllib3.util.ssl_ import (
ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_' (C:\Users\Administrator\anaconda3\lib\site-packages\urllib3\util\ssl_.py)
You need to activate your environment in the command-line.
For instance: Assume your environment name is conda_torch
conda activate conda_torch then an activated environment will be available.
Then you should type: python KD.py
I am struggling because of the error
AttributeError: module 'pandas' has no attribute 'core'
since quite a long time please refer the output of "import pandas" below. I have searched for this error on the net and searched at many places tried many things but was unable to resolve it. The problem was the solutions provided were more realted to other operating systems like Mac and Linux while I am using Windows 7 Professional.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\series.py", line 66, in <module>
import pandas.core.ops as ops
AttributeError: module 'pandas' has no attribute 'core'
Please do ask if you need any other details. I will be really gratified if you help me through this.
Thankyou
P.S if you can suggest a solution which does not use internet using terminal such as in case of "pip install pandas" as the company's network access is restricted. So, I installed all the dependencies of pandas through whl files which are downloadable through the access the company has provided.
Edit: The first time I execute pandas it shows and rest it shows the error shown above
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\series.py", line 3978, in <module>
Series._add_series_or_dataframe_operations()
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\generic.py", line 8891, in _add_series_or_dataframe_operations
from pandas.core import window as rwindow
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\window.py", line 36, in <module>
import pandas._libs.window as _window
ImportError: DLL load failed: The specified module could not be found.
conda upgrade --all
Upgrade your library and restart your notebook.This will do the work.
I creat a new environment by anaconda,but when I want to launch spyder,I meet the below problem. Who can help me?
(sae) C:\Users\limin>spyder
Traceback (most recent call last):
File "C:\Users\limin\Anaconda3\envs\sae\Scripts\spyder-script.py", line 3, in <module>
import spyder.app.start
File "C:\Users\limin\Anaconda3\Lib\site-packages\spyder\app\start.py", line 23, in <module>
from spyder.utils.external import lockfile
File "C:\Users\limin\Anaconda3\Lib\site-packages\spyder\utils\external\lockfile.py", line 22, in <module>
import psutil
File "C:\Users\limin\Anaconda3\Lib\site-packages\psutil\__init__.py", line 126, in <module>
from . import _pswindows as _psplatform
File "C:\Users\limin\Anaconda3\Lib\site-packages\psutil\_pswindows.py", line 16, in <module>
from . import _psutil_windows as cext
ImportError: cannot import name _psutil_windows
After installing prospector by using pip install prospector, I execute this command.
prospector --version
I got this error
Traceback (most recent call last):
File "/home/ec2-user/ingestion/acadenv/bin/prospector", line 7, in <module>
from prospector.run import main
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/prospector/run.py", line 8, in <module>
from prospector import blender, postfilter, tools
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/prospector/tools/__init__.py", line 7, in <module>
from prospector.tools.pylint import PylintTool
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/prospector/tools/pylint/__init__.py", line 6, in <module>
from pylint.config import find_pylintrc
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/pylint/config.py", line 48, in <module>
from pylint import utils
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/pylint/utils.py", line 39, in <module>
from astroid import nodes, Module
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/astroid/__init__.py", line 54, in <module>
from astroid.nodes import *
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/astroid/nodes.py", line 39, in <module>
from astroid.node_classes import (
File "/home/ec2-user/ingestion/acadenv/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 24, in <module>
import lazy_object_proxy
ImportError: No module named lazy_object_proxy
Moreover I have executed pip install lazy_object_proxy but this does not solve the problem also.