Anaconda broke itself upon updating - anaconda

So, Anaconda suggested me to do a conda update -n base -c defaults conda after I created a new environment, which I did. It ran for a few minutes, with huge amounds of warnings saying it couldn't delete some files. Then stopped, and now everything is broken.
I cannot update anaconda anymore, I cannot run conda info nor conda env list, I can't do anything. I can't use my envs through VScode either for example.
The output of conda info is:
>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 87, in _main
exit_code = do_call(args, p)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 82, in do_call
module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\index.py", line 15, in <module>
from .subdir_data import SubdirData, make_feature_record
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 54, in <module>
from conda_content_trust.common import (
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_content_trust\common.py", line 63, in <module>
import cryptography.hazmat.primitives.asymmetric.ed25519 as ed25519
File "C:\ProgramData\Anaconda3\lib\site-packages\cryptography\hazmat\primitives\asymmetric\ed25519.py", line 8, in <module>
from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
File "C:\ProgramData\Anaconda3\lib\site-packages\cryptography\exceptions.py", line 16, in <module>
class _Reasons(utils.Enum):
File "C:\ProgramData\Anaconda3\lib\site-packages\cryptography\utils.py", line 115, in __getattr__
obj = getattr(self._module, attr)
AttributeError: module 'cryptography.utils' has no attribute 'Enum'
$ C:\ProgramData\Anaconda3\Scripts\conda-script.py info
An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
I tried to install conda install anaconda-clean to erase it all cleanly, but I get the same error (cryptography).
It is really a problem in a moment when I need a functional python fast.
I am on Windows 10.
I am not so familiar with conda's inner working on a low level.
Please advise.
Thanks

Related

ModuleNotFoundError: No module named 'websockets.datastructures'

I don't know how to fix this error on Ubuntu.
I'm trying to run a FastApi server using uvicorn
uvicorn.run("api:app", host="0.0.0.0", port=3100, reload=True, workers=10)
I've tried pip3 install websockets :
Collecting websockets
Downloading https://files.pythonhosted.org/packages/7e/86/cef054220bc080451fe9663ce7f99beda0599098241190b6b6dc1073ab92/websockets-10.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (112kB)
100% |████████████████████████████████| 112kB 5.9MB/s
Installing collected packages: websockets
Successfully installed websockets-8.1
I don't know what else needs to be installed
Traceback (most recent call last):
File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/home/hafid/.local/lib/python3.7/site-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "/home/hafid/.local/lib/python3.7/site-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
return future.result()
File "/home/hafid/.local/lib/python3.7/site-packages/uvicorn/server.py", line 67, in serve
config.load()
File "/home/hafid/.local/lib/python3.7/site-packages/uvicorn/config.py", line 471, in load
ws_protocol_class = import_from_string(WS_PROTOCOLS[self.ws])
File "/home/hafid/.local/lib/python3.7/site-packages/uvicorn/importer.py", line 24, in import_from_string
raise exc from None
File "/home/hafid/.local/lib/python3.7/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/hafid/.local/lib/python3.7/site-packages/uvicorn/protocols/websockets/auto.py", line 17, in <module>
from uvicorn.protocols.websockets.websockets_impl import WebSocketProtocol
File "/home/hafid/.local/lib/python3.7/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 9, in <module>
from websockets.datastructures import Headers
ModuleNotFoundError: No module named 'websockets.datastructures'
To me, any of the two other answers work. I just upgrade websockets with:
pip install -U websockets
I had the same problem and i'm not sure why this happened but i'll atleast show you my workaround.
The best thing to do would be running:
pip uninstall websockets
pip install websockets
But for some reason this command could not uninstall it for me, so i did it manually.
Since u are in Ubuntu open this folder as root:
/usr/local/lib/python3.8/dist-packages/websocket
Then u can manually download the files at websockets current version files
In my case i noticed that in my old websockets folder i didn't have websockets.datastructures and also some other files such as the folders legacy and extensions so i just unzipped the whole library to the path cited above and it worked.
needed to update setuptools and pip
pip3 install -U setuptools
pip3 install -U pip

Error while running ARA server on Alpine linux

I am trying to install the latest version of the Ansible Records Analyzer server on an alpine Linux I made sure that all requirements are well installed ( Django, GCC,python3, Pypi, ansible) the install went well except for a warning about the absence of root PATH on the PATH variable which I fixed:
The warning :
WARNING: The script pbr is installed in '/root/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The fix:
~ # export PATH=/root/.local/bin:$PATH
So following the install guide on this step that intends to run the server I have an avalanche of errors as if the run command doesn't find the needed components to be executed although I'm sure all the components are installed :
~ # ara-manage runserver
[ara] No setting found for SECRET_KEY. Generating a random key...
Traceback (most recent call last):
File "/root/.local/bin/ara-manage", line 8, in <module>
sys.exit(main())
File "/root/.local/lib/python3.8/site-packages/ara/server/__main__.py", line 41, in main
if not os.path.exists(settings.ARA_SETTINGS):
File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/root/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/root/.local/lib/python3.8/site-packages/ara/server/settings.py", line 263, in <module>
ALLOWED_HOSTS=ALLOWED_HOSTS.to_list(),
AttributeError: 'list' object has no attribute 'to_list'
What could be the reason behind this behavior?
Well I managed to overcome this issue, the problem was in dynaconf the current version 3.1.3 doesn't read the conf files properly which fails in the server run.
Meanwhile, the only workaround is to install the previous version of dynaconf :
pip install 'dynaconf==3.1.2'
FYI dynaconf already has a fix proposed for the regression: rochacbruno/dynaconf#541
I've tested that it does resolve this issue and it will be released in dynaconf 3.1.4 soon.

OSError: [WinError 193] %1 is not a valid Win32 application (glumpy app)

Im getting this error while trying to run a code that uses glumpy library in python. Seems like the problem is when trying to run a command using "app". I'm using anaconda and python 3.6. I had hard time installing dlib and glumpy and I want to avoid installing them again on another environment. What can I do so i won't get this error? seems like the problem is in the package i guess?
Traceback (most recent call last):
File "C:/Users/טל קרני/PycharmProjects/untitled/graphicstry.py", line 64, in <module>
window = app.Window(color=(1, 1, 1, 1))
File "C:\anaconda\envs\env_dlib\lib\site-packages\glumpy\app\__init__.py", line 150, in __new__
backend = use(name)
File "C:\anaconda\envs\env_dlib\lib\site-packages\glumpy\app\__init__.py", line 116, in use
importlib.import_module(name)
File "C:\anaconda\envs\env_dlib\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\anaconda\envs\env_dlib\lib\site-packages\glumpy\app\window\backends\backend_glfw.py", line 82, in <module>
from glumpy.ext import glfw
File "C:\anaconda\envs\env_dlib\lib\site-packages\glumpy\ext\glfw.py", line 63, in <module>
_glfw = ctypes.CDLL(_glfw_file)
File "C:\anaconda\envs\env_dlib\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
This almost always means you're trying to load a 32-bit DLL into a 64-bit process, or vice versa. Are you running 64-bit Windows? Did you install 64-bit Python? Did you fetch the 64-bit person of glumpy?

ModuleNotFound error after sucessfully install cgal using conda?

I installed CGAL in windows using conda:
https://anaconda.org/conda-forge/cgal
But it gives error during importing modules.
>>> import CGAL
>>> print(CGAL.__version__)
4.14.0
>>> import CGAL.CGAL_AABB_tree
Traceback (most recent call last):
File "C:\Users\Ibrahim Khalilullah\.conda\envs\CGALCONDA\lib\site-packages\CGAL\CGAL_AABB_tree.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Ibrahim Khalilullah\.conda\envs\CGALCONDA\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ibrahim Khalilullah\.conda\envs\CGALCONDA\lib\site-packages\CGAL\CGAL_AABB_tree.py", line 17, in <module>
_CGAL_AABB_tree = swig_import_helper()
File "C:\Users\Ibrahim Khalilullah\.conda\envs\CGALCONDA\lib\site-packages\CGAL\CGAL_AABB_tree.py", line 16, in swig_import_helper
return importlib.import_module('_CGAL_AABB_tree')
File "C:\Users\Ibrahim Khalilullah\.conda\envs\CGALCONDA\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_CGAL_AABB_tree'
The issue is not the ModuleNotFoundError, but the underlying ImportError: DLL load failed:. Looking at your error message, you can see that your python does succesfully locate what you are trying to import at
C:\Users\Ibrahim Khalilullah\.conda\envs\CGALCONDA\lib\site-packages\CGAL\CGAL_AABB_tree.py
but fails to load a dependent DLL.
I have reproduced your issue. It seems to be one that only effects the most current of cgal in conda forge, which is 4.14 When you install the 4.13 version everything works fine, so simply do:
conda remove cgal
conda install -c conda-forge cgal==4.13
I have created an issue on the conda-forge feedstock

Error occurs during installation of Robot Framework with Python on Windows 7

I have installed "python-3.3.0.msi" successfully and set up PATH as "C:\Python33;" on Windows 7. After that I tried to install Robot Framework by using "robotframework-2.7.7.win32.exe" (double click on the .exe file). At the last step of installation I found the following error:
File "<string>", line 35
except Exception, err:
^
SyntaxError: invalid syntax
I clicked on "Finish" button --> Installation wizard was disappeared. I set the PATH as "C:\Python33\Scripts". Then I checked the version by using the command "pybot --version" at command prompt. Below error was shown:
Traceback (most recent call last):
File "C:\Python33\lib\runpy.py", line 140, in _run_module_as_main
mod_name, loader, code, fname = _get_module_details(mod_name)
File "C:\Python33\lib\runpy.py", line 102, in _get_module_details
loader = get_loader(mod_name)
File "C:\Python33\lib\pkgutil.py", line 482, in get_loader
return find_loader(fullname)
File "C:\Python33\lib\pkgutil.py", line 499, in find_loader
pkg = importlib.import_module(pkg_name)
File "C:\Python33\lib\importlib\__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1023, in load_module
File "<frozen importlib._bootstrap>", line 1004, in load_module
File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 869, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "C:\Python33\lib\site-packages\robot\__init__.py", line 22, in <module>
from robot.rebot import rebot, rebot_cli
File "C:\Python33\lib\site-packages\robot\rebot.py", line 268, in <module>
from robot.conf import RebotSettings
File "C:\Python33\lib\site-packages\robot\conf\__init__.py", line 17, in <mo
from .settings import RobotSettings, RebotSettings
File "C:\Python33\lib\site-packages\robot\conf\settings.py", line 172
except EnvironmentError, err:
^
SyntaxError: invalid syntax
How can I solve the above error?
Robot Framework doesn't support Python 3 yet. You should try to use Python 2.7 instead. (Python 3 changes lots of things in the language syntax, including the syntax for catching exceptions shown in this traceback). So, follow the following installation steps:
Install Python2.7.3
Install robotframework2.7.7
set PATH as "C:\Python27\;C:\Python27\Scripts\"
Verify the installation by using the command "pybot --version" at command prompt. If everything is OK, the
following message will be displayed:
"Robot Framework 2.7.7 (Python 2.7.3 on win32)"
you should run "pip install robotframework-python3"
https://pypi.python.org/pypi/robotframework-python3

Resources