Cannot run python script in command line - urllib3.util.ssl_ - python

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

Related

I got the error After I installed ryu on my ubuntu

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.

ModuleNotFoundError: No module named 'mimetypes'

The following error pops out whenever I enter commands like
conda info -e
conda update condo
or
conda create env -n 123 in the terminal.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
...
from ..gateways.connection.download import download
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/conda/gateways/connection/__init__.py", line 39, in <module>
from pip._vendor.requests import ConnectionError, HTTPError, Session
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/requests/__init__.py", line 43, in <module>
from pip._vendor import urllib3
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/__init__.py", line 7, in <module>
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/connectionpool.py", line 38, in <module>
from .request import RequestMethods
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/request.py", line 3, in <module>
from .filepost import encode_multipart_formdata
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/filepost.py", line 10, in <module>
from .fields import RequestField
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/fields.py", line 3, in <module>
import mimetypes
ModuleNotFoundError: No module named 'mimetypes'
How can it be fixed?
Try using the command in command-prompt: pip install mimetypes and reopen the file.
Hope it works!

How to use base Anaconda environment in PyCharm

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:

Can't open spyder in windows 10 in a new environment

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

In centos - No module named lazy_object_proxy while executing prospector library for python

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.

Categories

Resources