Unable to activate PythonAdv env due to KeyError('pkgs_dirs') - python

I am unable to delete or create or activate python env due to following error:
anand#DESKTOP-UHNCL5C MINGW64 ~
$ source activate PythonAdv
WARNING conda.exceptions:print_unexpected_error_report(1251): KeyError('pkgs_dirs')
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1129, in call
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 111, in main_sourced
print(activator.execute(), end="")
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 167, in execute
return getattr(self, self.command)()
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 141, in activate
builder_result = self.build_activate(self.env_name_or_prefix)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 288, in build_activate
return self._build_activate_stack(env_name_or_prefix, False)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 303, in _build_activate_stack
prefix = locate_prefix_by_name(env_name_or_prefix)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\base\context.py", line 1730, in locate_prefix_by_name
envs_dirs = context.envs_dirs
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\base\context.py", line 542, in envs_dirs
return mockable_context_envs_dirs(self.root_writable, self.root_prefix, self._envs_dirs)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\base\context.py", line 114, in mockable_context_envs_dirs
fixed_dirs += join(user_data_dir(APP_NAME, APP_NAME), 'envs'),
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda_vendor\appdirs.py", line 265, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1249, in print_unexpected_error_report
message_builder.append(get_main_info_str(error_report['conda_info']))
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main_info.py", line 237, in get_main_info_str
info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key])
KeyError: 'pkgs_dirs'
>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\exceptions.py", line 1129, in __call__
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 111, in main_sourced
print(activator.execute(), end="")
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 167, in execute
return getattr(self, self.command)()
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 141, in activate
builder_result = self.build_activate(self.env_name_or_prefix)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 288, in build_activate
return self._build_activate_stack(env_name_or_prefix, False)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\activate.py", line 303, in _build_activate_stack
prefix = locate_prefix_by_name(env_name_or_prefix)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\base\context.py", line 1730, in locate_prefix_by_name
envs_dirs = context.envs_dirs
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\base\context.py", line 542, in envs_dirs
return mockable_context_envs_dirs(self.root_writable, self.root_prefix, self._envs_dirs)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\base\context.py", line 114, in mockable_context_envs_dirs
fixed_dirs += join(user_data_dir(APP_NAME, APP_NAME), 'envs'),
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 265, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified procedure could not be found.
$ C:\ProgramData\Anaconda3\Scripts\conda-script.py shell.posix activate PythonAdv
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
An unexpected error has occurred. Conda has prepared the above report.
My .condarc looks like this:
ssl_verify: true
channels:
conda-forge
defaults
default_python:
pkgs_dirs:
'C:\Users\anand\conda\pkgs'
'%userprofile%.conda/pkgs'
Request help resolve this issue.

Related

Any conda command shows this error report

$ conda info --envs
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/main.py", line 87, in _main
exit_code = do_call(args, p)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/main_info.py", line 317, in execute
info_dict = get_info_dict(args.system)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/main_info.py", line 135, in get_info_dict
_supplement_index_with_system(virtual_pkg_index)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/core/index.py", line 164, in _supplement_index_with_system
dist_name, dist_version = context.os_distribution_name_version
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
cache[inner_attname] = func(self)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/base/context.py", line 863, in os_distribution_name_version
from conda._vendor.distro import id, version
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 1084, in <module>
_distro = LinuxDistribution()
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 599, in __init__
self._lsb_release_info = self._get_lsb_release_info() \
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 943, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
`$ /home/user/miniconda3/bin/conda info --envs`
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?
[y/N]: y
Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/main.py", line 87, in _main
exit_code = do_call(args, p)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/main_info.py", line 317, in execute
info_dict = get_info_dict(args.system)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/main_info.py", line 135, in get_info_dict
_supplement_index_with_system(virtual_pkg_index)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/core/index.py", line 164, in _supplement_index_with_system
dist_name, dist_version = context.os_distribution_name_version
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
cache[inner_attname] = func(self)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/base/context.py", line 863, in os_distribution_name_version
from conda._vendor.distro import id, version
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 1084, in <module>
_distro = LinuxDistribution()
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 599, in __init__
self._lsb_release_info = self._get_lsb_release_info() \
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 943, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/miniconda3/bin/conda", line 13, in <module>
sys.exit(main())
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/cli/main.py", line 155, in main
return conda_exception_handler(_main, *args, **kwargs)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1374, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1085, in __call__
return self.handle_exception(exc_val, exc_tb)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1129, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1144, in handle_unexpected_exception
self._execute_upload(error_report)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1306, in _execute_upload
'User-Agent': self.user_agent,
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1104, in user_agent
return context.user_agent
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
cache[inner_attname] = func(self)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/base/context.py", line 805, in user_agent
builder.append("%s/%s" % self.os_distribution_name_version)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
cache[inner_attname] = func(self)
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/base/context.py", line 863, in os_distribution_name_version
from conda._vendor.distro import id, version
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 1084, in <module>
_distro = LinuxDistribution()
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 599, in __init__
self._lsb_release_info = self._get_lsb_release_info() \
File "/home/user/miniconda3/lib/python3.9/site-packages/conda/_vendor/distro.py", line 943, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
Hi, I keep getting this ERROR REPORT for any conda command (conda info, conda install, conda whatever).
I removed and re-installed anaconda but then I get the same error, so I removed everything and installed miniconda, then I re-installed miniconda, then I also re-installed Ubuntu.
None of the above clearly solved the problem and this ERROR REPORT comes and goes.
Any help would be appreciated.

Issue creating conda environment in miniconda3

I am trying to create a new environment in miniconda using the following
(base) C:\Users\User>conda create -n myenv python=3.10
But am getting the following error report:
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Users\User\miniconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main.py", line 87, in _main
exit_code = do_call(args, p)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main_create.py", line 21, in execute
if is_conda_environment(context.target_prefix):
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 591, in target_prefix
return determine_target_prefix(self)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 1738, in determine_target_prefix
return locate_prefix_by_name(prefix_name)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 1681, in locate_prefix_by_name
envs_dirs = context.envs_dirs
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 517, in envs_dirs
return mockable_context_envs_dirs(self.root_writable, self.root_prefix, self._envs_dirs)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 91, in mockable_context_envs_dirs
fixed_dirs += join(user_data_dir(APP_NAME, APP_NAME), 'envs'),
File "C:\Users\User\miniconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "C:\Users\User\miniconda3\lib\site-packages\conda\_vendor\appdirs.py", line 284, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified procedure could not be found.
`$ C:\Users\User\miniconda3\Scripts\conda-script.py create -n myenv python=3.10`
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
I have recently installed miniconda but thought I would see if there is any updates that are causing the issues so I ran
(base) C:\Users\User>conda update conda
And got a similar error:
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Users\User\miniconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main.py", line 87, in _main
exit_code = do_call(args, p)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main_update.py", line 20, in execute
install(args, parser, 'update')
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\install.py", line 260, in install
unlink_link_transaction = solver.solve_for_transaction(
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\solve.py", line 152, in solve_for_transaction
unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\solve.py", line 195, in solve_for_diff
final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\solve.py", line 300, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "C:\Users\User\miniconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
return f(*args, **kwds)
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\solve.py", line 463, in _collect_all_metadata
index, r = self._prepare(prepared_specs)
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\solve.py", line 1058, in _prepare
reduced_index = get_reduced_index(self.prefix, self.channels,
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\index.py", line 288, in get_reduced_index
new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\subdir_data.py", line 118, in query_all
create_cache_dir()
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\subdir_data.py", line 876, in create_cache_dir
cache_dir = join(PackageCacheData.first_writable().pkgs_dir, 'cache')
File "C:\Users\User\miniconda3\lib\site-packages\conda\core\package_cache_data.py", line 151, in first_writable
pkgs_dirs = context.pkgs_dirs
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 530, in pkgs_dirs
fixed_dirs += user_data_dir(APP_NAME, APP_NAME),
File "C:\Users\User\miniconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "C:\Users\User\miniconda3\lib\site-packages\conda\_vendor\appdirs.py", line 284, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified procedure could not be found.
`$ C:\Users\User\miniconda3\Scripts\conda-script.py update conda`
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
I am an R user so not familiar with Python but to me, this suggests that there is something wrong with my install.
The answer comes from here as suggested by #w08r
Posting here in case anyone else finds this post first. Install an older version on win32.com:
pip install pywin32==300
For some reason
pip install pywin32==301
doesn't work for me, similar to mentioned in the comments in linked answer.

Issue setting up acoustic-bird-detection using miniconda and Python 3.10.7

I am attempting to run through the README of the acoustic-bird-detection, but am getting this issue in the second line of code. I am new to Python so am not sure if this is a local issue or an issue with the resources themselves.
There seem to be a lot of issues which is making me suspect it is a local issue with my directory
(base) C:\Users\User>conda create -n birdsounds python=3.7
WARNING conda.exceptions:print_unexpected_error_report(1216): KeyError('pkgs_dirs')
Traceback (most recent call last):
File "C:\Users\User\miniconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main.py", line 87, in _main
exit_code = do_call(args, p)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main_create.py", line 21, in execute
if is_conda_environment(context.target_prefix):
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 591, in target_prefix
return determine_target_prefix(self)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 1738, in determine_target_prefix
return locate_prefix_by_name(prefix_name)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 1681, in locate_prefix_by_name
envs_dirs = context.envs_dirs
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 517, in envs_dirs
return mockable_context_envs_dirs(self.root_writable, self.root_prefix, self._envs_dirs)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 91, in mockable_context_envs_dirs
fixed_dirs += join(user_data_dir(APP_NAME, APP_NAME), 'envs'),
File "C:\Users\User\miniconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "C:\Users\User\miniconda3\lib\site-packages\conda\_vendor\appdirs.py", line 284, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\User\miniconda3\lib\site-packages\conda\exceptions.py", line 1214, in print_unexpected_error_report
message_builder.append(get_main_info_str(error_report['conda_info']))
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main_info.py", line 237, in get_main_info_str
info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key])
KeyError: 'pkgs_dirs'
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Users\User\miniconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
return func(*args, **kwargs)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main.py", line 87, in _main
exit_code = do_call(args, p)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\conda_argparse.py", line 84, in do_call
return getattr(module, func_name)(args, parser)
File "C:\Users\User\miniconda3\lib\site-packages\conda\cli\main_create.py", line 21, in execute
if is_conda_environment(context.target_prefix):
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 591, in target_prefix
return determine_target_prefix(self)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 1738, in determine_target_prefix
return locate_prefix_by_name(prefix_name)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 1681, in locate_prefix_by_name
envs_dirs = context.envs_dirs
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 517, in envs_dirs
return mockable_context_envs_dirs(self.root_writable, self.root_prefix, self._envs_dirs)
File "C:\Users\User\miniconda3\lib\site-packages\conda\base\context.py", line 91, in mockable_context_envs_dirs
fixed_dirs += join(user_data_dir(APP_NAME, APP_NAME), 'envs'),
File "C:\Users\User\miniconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "C:\Users\User\miniconda3\lib\site-packages\conda\_vendor\appdirs.py", line 284, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified procedure could not be found.
`$ C:\Users\User\miniconda3\Scripts\conda-script.py create -n birdsounds python=3.7`
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
I am using Windows 10.

Installing geopandas with anaconda prompt causes ImportError

I am aiming to analyse geodata in python but fail on step 1: the installation. I'm relatively new to python and used to installing packages with pip. Now, for geopandas, it looks like I'm supposed to use conda install. Sadly, I get an error.
What I did: I downloaded the most recent anconda software and typed 'conda install geopandas' in the anaconda prompt (anaconda3).
Reading similar questions online I saw some questions solved by updating anaconda, but since I downloaded the version on the homepage I would expect it to be up to date. Also, I didn't find any entries with error code similar to mine.
From what I gather from the response, anaconda didn't even manage to find the package (first line of the below code). However, I am not very experienced in the analysis of error code.
Any help would be greatly appreciated!
The error-code
Collecting package metadata (current_repodata.json): failed
WARNING conda.exceptions:print_unexpected_error_report(1213): KeyError('pkgs_dirs')
Traceback (most recent call last):
File "D:\Programs\Anaconda3\lib\site-packages\conda\exceptions.py", line 1079, in __call__
return func(*args, **kwargs)
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 83, in do_call
return getattr(module, func_name)(args, parser)
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 20, in execute
install(args, parser, 'install')
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\install.py", line 261, in install
unlink_link_transaction = solver.solve_for_transaction(
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 114, in solve_for_transaction
unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 157, in solve_for_diff
final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 262, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "D:\Programs\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
return f(*args, **kwds)
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 425, in _collect_all_metadata
index, r = self._prepare(prepared_specs)
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 1020, in _prepare
reduced_index = get_reduced_index(self.prefix, self.channels,
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\index.py", line 276, in get_reduced_index
new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 98, in query_all
create_cache_dir()
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 674, in create_cache_dir
cache_dir = join(PackageCacheData.first_writable().pkgs_dir, 'cache')
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 152, in first_writable
pkgs_dirs = context.pkgs_dirs
File "D:\Programs\Anaconda3\lib\site-packages\conda\base\context.py", line 520, in pkgs_dirs
fixed_dirs += user_data_dir(APP_NAME, APP_NAME),
File "D:\Programs\Anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "D:\Programs\Anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 284, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Programs\Anaconda3\lib\site-packages\conda\exceptions.py", line 1211, in print_unexpected_error_report
message_builder.append(get_main_info_str(error_report['conda_info']))
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\main_info.py", line 238, in get_main_info_str
info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key])
KeyError: 'pkgs_dirs'
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "D:\Programs\Anaconda3\lib\site-packages\conda\exceptions.py", line 1079, in __call__
return func(*args, **kwargs)
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 83, in do_call
return getattr(module, func_name)(args, parser)
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\main_install.py", line 20, in execute
install(args, parser, 'install')
File "D:\Programs\Anaconda3\lib\site-packages\conda\cli\install.py", line 261, in install
unlink_link_transaction = solver.solve_for_transaction(
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 114, in solve_for_transaction
unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 157, in solve_for_diff
final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 262, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "D:\Programs\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
return f(*args, **kwds)
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 425, in _collect_all_metadata
index, r = self._prepare(prepared_specs)
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\solve.py", line 1020, in _prepare
reduced_index = get_reduced_index(self.prefix, self.channels,
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\index.py", line 276, in get_reduced_index
new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 98, in query_all
create_cache_dir()
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 674, in create_cache_dir
cache_dir = join(PackageCacheData.first_writable().pkgs_dir, 'cache')
File "D:\Programs\Anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 152, in first_writable
pkgs_dirs = context.pkgs_dirs
File "D:\Programs\Anaconda3\lib\site-packages\conda\base\context.py", line 520, in pkgs_dirs
fixed_dirs += user_data_dir(APP_NAME, APP_NAME),
File "D:\Programs\Anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
path = os.path.join(_get_win_folder(const), appauthor, appname)
File "D:\Programs\Anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 284, in _get_win_folder_with_pywin32
from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified module could not be found.
`$ D:\Programs\Anaconda3\Scripts\conda-script.py install geopandas`
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
An unexpected error has occurred. Conda has prepared the above report.
I had the same issue back then, and I followed the instructions on this link.
https://medium.com/analytics-vidhya/fastest-way-to-install-geopandas-in-jupyter-notebook-on-windows-8f734e11fa2b
Basically what this does is create a new environment in your anaconda navigator where I could get geopandas working normally.

No module named misc when implementing a simple pytest plugin?

I'm trying to implement the pytest plugin mentioned in https://github.com/pytest-dev/pytest/issues/2039, basically this plugin will print all tests that pytest finds:
## pytest_collector.py
import sys
import pytest
class DkPytestCollector(object):
def __init__(self):
self.collected = []
def pytest_collection_modifyitems(self, items):
for item in items:
self.collected.append(item.nodeid)
if __name__ == '__main__':
dkpytest_collector = DkPytestCollector()
directory = sys.argv[1]
pytest.main(['--collect-only', directory], plugins=[dkpytest_collector])
print('\n\nfound:')
for nodeid in dkpytest_collector.collected:
print(nodeid)
however, when I run it I get:
(dk) go|c:\srv\lib\dk> python ..\dkbuild\dkbuild\pytest_collector.py \srv\lib\dk
Traceback (most recent call last):
File "..\dkbuild\dkbuild\pytest_collector.py", line 20, in <module>
pytest.main(['--collect-only', directory], plugins=[dkpytest_collector])
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 50, in main
config = _prepareconfig(args, plugins)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 160, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 196, in _multicall
gen.send(outcome)
File "c:\srv\venv\dk\lib\site-packages\_pytest\helpconfig.py", line 68, in pytest_cmdline_parse
config = outcome.get_result()
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 77, in get_result
_reraise(*ex) # noqa
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 943, in pytest_cmdline_parse
self.parse(args)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 1108, in parse
self._preparse(args, addopts=addopts)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 1071, in _preparse
self.pluginmanager.load_setuptools_entrypoints('pytest11')
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 397, in load_setuptools_entrypoints
plugin = ep.load()
File "c:\srv\venv\dk\lib\site-packages\pkg_resources\__init__.py", line 2405, in load
return self.resolve()
File "c:\srv\venv\dk\lib\site-packages\pkg_resources\__init__.py", line 2411, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "c:\srv\venv\dk\lib\site-packages\_pytest\assertion\rewrite.py", line 212, in load_module
py.builtin.exec_(co, mod.__dict__)
File "c:\srv\venv\dk\lib\site-packages\py\_builtin.py", line 221, in exec_
exec2(obj, globals, locals)
File "<string>", line 7, in exec2
File "c:\srv\venv\dk\lib\site-packages\pytest_cov\plugin.py", line 6, in <module>
from coverage.misc import CoverageException
ImportError: No module named misc
if I pip uninstall pytest-cov everything works (well, except no coverage..)
How do I get this to work without uninstalling pytest-cov?

Categories