Issue creating conda environment in miniconda3 - python

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.

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.

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

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.

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.

pytest KeyError: 'USER' within docker container

I am in the process of building a docker container that will run my automation tests. When I attempt to run the command below [this works locally and in jenkins] I get the following error:
root#645ed3930434:/test_dir# pytest test_* -m smoke
Traceback (most recent call last):
File "/usr/local/bin/pytest", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 49, in main
config = _prepareconfig(args, plugins)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 168, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
wrap_controller.send(call_outcome)
File "/usr/local/lib/python3.5/dist-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
config = outcome.get_result()
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
raise ex[1].with_traceback(ex[2])
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
self.result = func()
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 957, in pytest_cmdline_parse
self.parse(args)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 1121, in parse
self._preparse(args, addopts=addopts)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 1084, in _preparse
self.pluginmanager.load_setuptools_entrypoints('pytest11')
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 516, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 264, in register
ret = super(PytestPluginManager, self).register(plugin, name)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 371, in register
hook._maybe_apply_history(hookimpl)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 768, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/usr/local/lib/python3.5/dist-packages/pytest_cloud/plugin.py", line 76, in pytest_addoption
os.environ['USER'],
File "/usr/lib/python3.5/os.py", line 725, in __getitem__
raise KeyError(key) from None
KeyError: 'USER'
I am new to docker, so I do not understand what is causing this error.
I am starting with a ubuntu as my base [this also happens when using a https://hub.docker.com/_/python/ as my base]
for reference requirements.txt includes the following:
apipkg==1.4
certifi==2017.11.5
chardet==3.0.4
execnet==1.5.0
idna==2.6
parameterized==0.6.1
psutil==5.4.1
py==1.5.2
pytest==3.2.5
pytest-cloud==2.0.0
pytest-forked==0.2
pytest-xdist==1.20.1
requests==2.18.4
six==1.11.0
timeout-decorator==0.4.0
urllib3==1.22
I have installed Python 3.5.2 in the container
The 'USER' environment variable seems not to defined within your image. Define it externally, or make your code resilient to its absence:
In your code, use os.getenv('USER', backup_user_name) instead of os.environ['USER']
In your code, use getpass instead of relying on your environment to get the current user.
import getpass
print getpass.getuser()
In docker run, you could add -e USER=$(whoami) or something of that sort
In docker-compose, you could add USER: some_user_name under the environ setting for that service.

Categories