I can't install packages anymore.
Every time I try to run:
py -m pip install [name of the package]
I get:
Traceback (most recent call last):
File "C:\Users\Filippo Sebastio\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Filippo Sebastio\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Filippo Sebastio\Anaconda3\lib\site-packages\pip\__main__.py", line 19, in <module>
sys.exit(_main())
File "C:\Users\Filippo Sebastio\Anaconda3\lib\site-packages\pip\_internal\__init__.py", line 246, in main
return command.main(cmd_args)
File "C:\Users\Filippo Sebastio\Anaconda3\lib\site-packages\pip\_internal\basecommand.py", line 264, in main
timeout=min(5, options.timeout)) as session:
File "C:\Users\Filippo Sebastio\Anaconda3\lib\site-packages\pip\_internal\basecommand.py", line 81, in _build_session
insecure_hosts=options.trusted_hosts,
File "C:\Users\Filippo Sebastio\Anaconda3\lib\site-packages\pip\_internal\download.py", line 338, in __init__
self.headers["User-Agent"] = user_agent()
File "C:\Users\Filippo Sebastio\Anaconda3\lib\site-packages\pip\_internal\download.py", line 125, in user_agent
data["openssl_version"] = ssl.OPENSSL_VERSION
AttributeError: module 'ssl' has no attribute 'OPENSSL_VERSION'
I have no idea of what happened but I am afraid I deleted part of the ssl script (which I am not even sure how I opened!)
Related
Hey guys I am trying to open Jupyter Lab and install some packages from the command line and I get the following error, it looks like python is being used by other process.
Traceback (most recent call last):
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 92, in _tempfile
os.write(fd, reader())
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\Scripts\jupyter-lab.exe\__main__.py", line 4, in <module>
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab\labapp.py", line 15, in <module>
from jupyterlab_server import (
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab_server\__init__.py", line 5, in <module>
from .app import LabServerApp
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab_server\app.py", line 10, in <module>
from .handlers import LabConfig, add_handlers
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab_server\handlers.py", line 18, in <module>
from .listings_handler import ListingsHandler, fetch_listings
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab_server\listings_handler.py", line 8, in <module>
import requests
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\__init__.py", line 147, in <module>
from . import packages, utils
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\utils.py", line 24, in <module>
from . import certs
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\certs.py", line 14, in <module>
from certifi import where
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 72, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 98, in _tempfile
_os_remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\loque\\AppData\\Local\\Temp\\tmpfsz7k7d8'
How can I fix this?
I try Re-installing python and even installing other versions, not working still :(
I also deleted all the contents in the Temp folders and once i run the code it creates a new temp file that uses the process.
I have been using pip to install python libraries . All of a sudden , it now gives me this strange error whenever I try to run pip.
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 87, in _tempfile
fd, raw_path = tempfile.mkstemp(suffix=suffix)
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 337, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "C:\Users\arpit\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 249, in _mkstemp_inner
file = _os.path.join(dir, pre + name + suf)
TypeError: can only concatenate str (not "method") to str
(Hidden some of the output as it was too big)
The last command I used with pip was
pip install python-certifi-win32
I am not sure how it happened. How do I fix this ?
My folder structure is:
.
- test/modules
| - parseTests.py
The source of parseTests.py is copied and pasted from here (Unittest Basic Example).
When I run python -m unittest, no tests are found.
When I run python -m unittest ./modules/tests/parseTests.py, I receive the following error:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/__main__.py", line 18, in <module>
main(module=None)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/main.py", line 100, in __init__
self.parseArgs(argv)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/main.py", line 147, in parseArgs
self.createTests()
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/main.py", line 159, in createTests
self.module)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 220, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 154, in loadTestsFromName
module = __import__(module_name)
ValueError: Empty module name
What am I doing wrong?
Just trying to run jupyter notebook with pip. What the hell is happening? I tried to run it like this "python -m notebook", because just "jupyter notebook" or just "notebook" doesn't even get recognized.
C:\**\**>python -m notebook
Traceback (most recent call last):
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\runpy.py",
line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\runpy.py",
line 86, in _run_code
exec(code, run_globals)
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\notebook\__main__.py", line 5, in <module>
app.launch_new_instance()
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\jupyter_core\application.py", line 268, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "<C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packa
ges\decorator.py:decorator-gen-7>", line 2, in initialize
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\notebook\notebookapp.py", line 1720, in initialize
self.init_webapp()
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\notebook\notebookapp.py", line 1482, in init_webapp
self.http_server.listen(port, self.ip)
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\tornado\tcpserver.py", line 152, in listen
self.add_sockets(sockets)
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\tornado\tcpserver.py", line 165, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\tornado\netutil.py", line 279, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\site-packag
es\tornado\platform\asyncio.py", line 99, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\**\**\AppData\Local\Programs\Python\Python38-32\lib\asyncio\eve
nts.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
Your local installation of jupyter via pip is conflicting with your Anaconda installation. There are some situations where you may need more than one instance of python (e.g. if you need to test code with different versions of python, or some applications require a separate instance, but you seem like you might want to limit your installations to just a single instance.
Remember to use environments to keep your package list clean.
I'm a Mac user, and I frequently face frustrations when installing python packages.
This time, pipenv seems not working properly.
I successfully installed pipenv.
$pipenv --version
pipenv, version 11.10.1
However, When I try to init pipenv shell, I got error like this:
Creating a virtualenv for this project…
Using /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 (3.6.4) to create virtualenv…
⠋Already using interpreter /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 2349, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 712, in main
symlink=options.symlink)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 927, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 1140, in install_python
copy_required_modules(home_dir, symlink)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 1070, in copy_required_modules
dst_filename = change_prefix(filename, dst_prefix)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 1044, in change_prefix
(filename, prefixes)
AssertionError: Filename /Users/ChaewonKong/Desktop/dev/re.py does not start with any of these prefixes: ['/Library/Frameworks/Python.framework/Versions/3.6/Extras/lib/python', '/Users/ChaewonKong/Library/Python/3.6/lib/python/site-packages', '/Users/ChaewonKong/.local/lib/python/3.6/site-packages', '/Users/ChaewonKong/Library/Python/3.6/site-packages', '/Library/Frameworks/Python.framework/Versions/3.6', '/Library/Frameworks/Python.framework/Versions/3.6', '/Library/Python/3.6/site-packages']
Virtualenv location:
Creating a Pipfile for this project…
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/cli.py", line 607, in shell
three=three, python=python, fancy=fancy, shell_args=shell_args
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/core.py", line 2149, in do_shell
ensure_project(three=three, python=python, validate=False)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/core.py", line 648, in ensure_project
ensure_pipfile(validate=validate, skip_requirements=skip_requirements, system=system)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/core.py", line 302, in ensure_pipfile
project.create_pipfile(python=python)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/project.py", line 588, in create_pipfile
required_python = self.which('python')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/core.py", line 126, in which
p = os.sep.join([location] + ['bin/{0}'.format(command)])
TypeError: sequence item 0: expected str instance, NoneType found
This pipenv issues page has the answer you are looking for:
TypeError issue