Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadLibrary error when invoking conda-build on Windows 7 #3220

Closed
gwerbin opened this issue Oct 17, 2018 · 16 comments
Closed

LoadLibrary error when invoking conda-build on Windows 7 #3220

gwerbin opened this issue Oct 17, 2018 · 16 comments
Labels
locked [bot] locked due to inactivity

Comments

@gwerbin
Copy link

gwerbin commented Oct 17, 2018

conda build

Actual Behavior

$ conda build
Traceback (most recent call last):
  File "C:\Anaconda3\Scripts\conda-build-script.py", line 6, in <module>
    from conda_build.cli.main_build import main
  File "C:\Anaconda3\lib\site-packages\conda_build\cli\main_build.py", line 18, in <module>
    import conda_build.api as api
  File "C:\Anaconda3\lib\site-packages\conda_build\api.py", line 22, in <module>
    from conda_build.config import Config, get_or_merge_config, DEFAULT_PREFIX_LENGTH as _prefix_length
  File "C:\Anaconda3\lib\site-packages\conda_build\config.py", line 17, in <module>
    from .variants import get_default_variant
  File "C:\Anaconda3\lib\site-packages\conda_build\variants.py", line 15, in <module>
    from conda_build.utils import ensure_list, trim_empty_keys, get_logger
  File "C:\Anaconda3\lib\site-packages\conda_build\utils.py", line 10, in <module>
    import libarchive
  File "C:\Anaconda3\lib\site-packages\libarchive\__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "C:\Anaconda3\lib\site-packages\libarchive\entry.py", line 6, in <module>
    from . import ffi
  File "C:\Anaconda3\lib\site-packages\libarchive\ffi.py", line 27, in <module>
    libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
  File "C:\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
    return self._dlltype(name)
  File "C:\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None

Expected Behavior

usage: conda-build [-h] [-V] [-n] [--output] [--python PYTHON] [--perl PERL]
                   [--numpy NUMPY] [--R R_BASE] [--lua LUA]
                   [--bootstrap BOOTSTRAP]
                   [--append-file APPEND_SECTIONS_FILE]
                   [--clobber-file CLOBBER_SECTIONS_FILE]
                   [-m VARIANT_CONFIG_FILES] [--old-build-string] [--check]
                   [--no-anaconda-upload] [--no-include-recipe] [-s] [-t]
                   [--no-test] [-b] [-p] [--skip-existing] [--keep-old-work]
                   [--dirty] [-q] [--debug] [--token TOKEN] [--user USER]
                   [--no-force-upload] [--password PASSWORD] [--sign SIGN]
                   [--sign-with SIGN_WITH] [--identity IDENTITY]
                   [--config-file CONFIG_FILE] [--repository REPOSITORY]
                   [--no-activate] [--no-build-id] [--croot CROOT] [--verify]
                   [--output-folder OUTPUT_FOLDER]
                   [--no-prefix-length-fallback] [--prefix-length-fallback]
                   [--prefix-length _PREFIX_LENGTH] [--no-locking]
                   [--no-remove-work-dir] [--long-test-prefix]
                   [--no-long-test-prefix] [--keep-going]
                   [--cache-dir CACHE_DIR] [--no-copy-test-source-files]
                   [-c CHANNEL] [--override-channels]
                   RECIPE_PATH [RECIPE_PATH ...]
conda-build: error: the following arguments are required: RECIPE_PATH

Steps to Reproduce

Honestly no idea

Output of conda info
     active environment : None
       user config file : C:\Users\<redacted>\.condarc
 populated config files : C:\Users\<redacted>\.condarc
          conda version : 4.5.11
    conda-build version : 3.16.1
         python version : 3.7.0.final.0
       base environment : C:\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/win-64
                          https://repo.anaconda.com/pkgs/pro/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
                          https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : C:\Anaconda3\pkgs
                          C:\Users\<redacted>\AppData\Local\conda\conda\pkgs
       envs directories : C:\Anaconda3\envs
                          C:\Users\<redacted>\AppData\Local\conda\conda\envs
                          C:\Users\<redacted>\.conda\envs
               platform : win-64
             user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Windows/7 Windows/6.1.7601
          administrator : True
             netrc file : None
           offline mode : False
@gwerbin gwerbin changed the title LoadLibrary error when invoking conda-build LoadLibrary error when invoking conda-build on Windows 7 Oct 17, 2018
@mingwandroid
Copy link
Contributor

This is unlikely anything to do with conda-build; probably some badly written software has installed some non-system DLLs in your C:\Windows\System32 folder. Please open an issue at https://github.com/anaconda-issues/issues

@gwerbin
Copy link
Author

gwerbin commented Oct 17, 2018

Thanks.

The issue only started after I foolishly did conda install -n base conda-build conda-env. Is it possible that I caused some binary incompatibility? I tried to find command output to see if I could roll back to the previous version but I had closed that terminal window before I realized what happened.

@mingwandroid
Copy link
Contributor

Please open an issue at https://github.com/anaconda-issues/issues

@gwerbin gwerbin closed this as completed Oct 17, 2018
@m-rossi
Copy link
Contributor

m-rossi commented Oct 17, 2018

I have the same issue on Windows 10.

@gwerbin
Copy link
Author

gwerbin commented Oct 17, 2018

BTW the correct issue tracker is https://github.com/ContinuumIO/anaconda-issues

@m-rossi
Copy link
Contributor

m-rossi commented Oct 17, 2018

It seems to be an issue with the PATH on windows. If you add %USERPROFILE%\AppData\Local\Continuum\anaconda3\bin to your PATH variable it works or you need to execute the build command inside the Anaconda Prompt.

@mingwandroid
Copy link
Contributor

Yes, our software does not work if you do not activate your environment(s), which the Anaconda Prompt does. Alternatively you can add to PATH but that doesn't run package activation scripts so some things will not work correctly.

@gwerbin
Copy link
Author

gwerbin commented Oct 17, 2018

@mingwandroid I've been using Anaconda and Conda build for over a year and haven't needed to use the Anaconda Prompt. Did something change in the recent version of conda-build?

Also is there some documentation on what exactly Anaconda Prompt does and how it's different from adding to PATH? And what happens to Miniconda users who dosn't have the prompt?

For debugging purposes yes, it looks like conda build works correctly in the Anaconda Prompt. It also works if I run activate base in a regular shell (CMD or Powershell). Seems like whatever worked before was a fluke, and that conda build should be run with the base environment active.

@msarahan
Copy link
Contributor

@m-rossi
Copy link
Contributor

m-rossi commented Oct 17, 2018

I got this error when testing a build inside Pycharm. I never thought about if Pycharm does proper activation of conda environments (although conda environments can be added easily as interpreters in the settings). This does not seem the case. I will try to find a solution.

@gwerbin
Copy link
Author

gwerbin commented Oct 17, 2018

Downgrading to 3.15 fixes the problem

conda install -n base conda==3.15 --yes
conda build
#usage: conda-build [-h] [-V] [-n] [--output] [--python PYTHON] [--perl PERL]
#                   [--numpy NUMPY] [--R R_BASE] [--lua LUA]
#                   [--bootstrap BOOTSTRAP]
#                   [--append-file APPEND_SECTIONS_FILE]
#                   [--clobber-file CLOBBER_SECTIONS_FILE]
#                   [-m VARIANT_CONFIG_FILES] [-e EXCLUSIVE_CONFIG_FILES]
#                   [--old-build-string] [--check] [--no-anaconda-upload]
#                   [--no-include-recipe] [-s] [-t] [--no-test] [-b] [-p]
#                   [--skip-existing] [--keep-old-work] [--dirty] [-q]
#                   [--debug] [--token TOKEN] [--user USER] [--label LABELS]
#                   [--no-force-upload] [--password PASSWORD] [--sign SIGN]
#                   [--sign-with SIGN_WITH] [--identity IDENTITY]
#                   [--config-file CONFIG_FILE] [--repository REPOSITORY]
#                   [--no-activate] [--no-build-id] [--croot CROOT] [--verify]
#                   [--no-verify] [--strict-verify]
#                   [--output-folder OUTPUT_FOLDER]
#                   [--no-prefix-length-fallback] [--prefix-length-fallback]
#                   [--prefix-length _PREFIX_LENGTH] [--no-locking]
#                   [--no-remove-work-dir] [--error-overlinking]
#                   [--no-error-overlinking] [--long-test-prefix]
#                   [--no-long-test-prefix] [--keep-going]
#                   [--cache-dir CACHE_DIR] [--no-copy-test-source-files]
#                   [--merge-build-host] [--stats-file STATS_FILE]
#                   [--extra-deps EXTRA_DEPS [EXTRA_DEPS ...]] [-c CHANNEL]
#                   [--override-channels]
#                   RECIPE_PATH [RECIPE_PATH ...]
#conda-build: error: the following arguments are required: RECIPE_PATH

conda install -n base conda-build==3.16.1 --yes
conda build
#Traceback (most recent call last):
#  File "C:\Anaconda3\Scripts\conda-build-script.py", line 6, in <module>
#    from conda_build.cli.main_build import main
#  File "C:\Anaconda3\lib\site-packages\conda_build\cli\main_build.py", line 18, in <module>
#    import conda_build.api as api
#  File "C:\Anaconda3\lib\site-packages\conda_build\api.py", line 22, in <module>
#    from conda_build.config import Config, get_or_merge_config, DEFAULT_PREFIX_LENGTH as _prefix_length
#  File "C:\Anaconda3\lib\site-packages\conda_build\config.py", line 17, in <module>
#    from .variants import get_default_variant
#  File "C:\Anaconda3\lib\site-packages\conda_build\variants.py", line 15, in <module>
#    from conda_build.utils import ensure_list, trim_empty_keys, get_logger
#  File "C:\Anaconda3\lib\site-packages\conda_build\utils.py", line 10, in <module>
#    import libarchive
#  File "C:\Anaconda3\lib\site-packages\libarchive\__init__.py", line 1, in <module>
#    from .entry import ArchiveEntry
#  File "C:\Anaconda3\lib\site-packages\libarchive\entry.py", line 6, in <module>
#    from . import ffi
#  File "C:\Anaconda3\lib\site-packages\libarchive\ffi.py", line 27, in <module>
#    libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
#  File "C:\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
#    return self._dlltype(name)
#  File "C:\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
#    self._handle = _dlopen(self._name, mode)
#TypeError: LoadLibrary() argument 1 must be str, not None

@mingwandroid
Copy link
Contributor

Also is there some documentation on what exactly Anaconda Prompt does and how it's different from adding to PATH? And what happens to Miniconda users who dosn't have the prompt?

How would anyone not have the Anaconda Prompt? We install it in both Miniconda and Anaconda.

Please use Google. Search for conda activate.

xiaoqiangwang added a commit to CaChannel/CaChannel that referenced this issue Dec 6, 2018
It used to work Ok without activating miniconda prompt,
but fails since python 3.7.
See here the error
https://ci.appveyor.com/project/xiaoqiangwang/cachannel/build/job/ebv97g6c61u9c12m#L239
and discussion
See conda/conda-build#3220
@astrofrog
Copy link

I'm seeing this exact error in AppVeyor with the latest conda-build (but I don't see it if I downgrade to conda-build 4.3.34):

https://ci.appveyor.com/project/astrofrog/pywwt/builds/21017691

Any idea what this could be due to?

@tritemio
Copy link

I am seeing this on AppVeyor too, but only on python 3.7, works on python 3.6

https://ci.appveyor.com/project/tritemio/phconvert/builds/23832227/job/mtw68shi02g0rh2j

fredrikw added a commit to fredrikw/conda-openbabel that referenced this issue Apr 15, 2019
justinGilmer added a commit to mattwthompson/mbuild that referenced this issue Jun 25, 2019
@leycec
Copy link

leycec commented Jun 27, 2019

Like @tritemio and @justinGilmer, we just hit this with Python 3.7 under AppVeyor. Unlike @tritemio, @justinGilmer, and presumably everyone else on this thread, we never run conda build.

Instead, simply attempting to run conda info --all early in our CI pipeline fails with a similar traceback:

conda info --all
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
    Traceback (most recent call last):
      File "C:\Miniconda37-x64\lib\site-packages\conda\exceptions.py", line 1043, in __call__
        return func(*args, **kwargs)
      File "C:\Miniconda37-x64\lib\site-packages\conda\cli\main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "C:\Miniconda37-x64\lib\site-packages\conda\cli\conda_argparse.py", line 80, in do_call
        module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
      File "C:\Miniconda37-x64\lib\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 "C:\Miniconda37-x64\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
        from ..core.index import _supplement_index_with_system
      File "C:\Miniconda37-x64\lib\site-packages\conda\core\index.py", line 9, in <module>
        from .package_cache_data import PackageCacheData
      File "C:\Miniconda37-x64\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
        from conda_package_handling.api import InvalidArchiveError
      File "C:\Miniconda37-x64\lib\site-packages\conda_package_handling\api.py", line 3, in <module>
        from libarchive.exception import ArchiveError as _LibarchiveArchiveError
      File "C:\Miniconda37-x64\lib\site-packages\libarchive\__init__.py", line 1, in <module>
        from .entry import ArchiveEntry
      File "C:\Miniconda37-x64\lib\site-packages\libarchive\entry.py", line 6, in <module>
        from . import ffi
      File "C:\Miniconda37-x64\lib\site-packages\libarchive\ffi.py", line 27, in <module>
        libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
      File "C:\Miniconda37-x64\lib\ctypes\__init__.py", line 434, in LoadLibrary
        return self._dlltype(name)
      File "C:\Miniconda37-x64\lib\ctypes\__init__.py", line 356, in __init__
        self._handle = _dlopen(self._name, mode)
    TypeError: LoadLibrary() argument 1 must be str, not None
`$ C:\Miniconda37-x64\Scripts\conda-script.py info --all`

An unexpected error has occurred. Conda has prepared the above report.

Clearly, our previously working AppVeyor configuration should not need to explicitly activate a base environment before running the idempotent conda info subcommand – but that's just what we now need to do.

Clearly, there be effluvious dragons here. 🐉

How would anyone not have the Anaconda Prompt? We install it in both Miniconda and Anaconda.

Please use Google. Search for conda activate.

@mingwandroid: Sadly, the conda activate subcommand failed hard under AppVeyor the last time we tested it. Although the decrepit activate script still behaves as expected, end users shouldn't have to explicitly activate base environments merely to run trivial subcommands like conda info.

If conda now requires base environments to be activated as a hard prerequisite to running any subcommand, then conda itself should automate this requirement on behalf of end users. Although the fix would ultimately be trivial on our end (e.g., via a one-liner running activate before conda info), we refuse on general principle to do so. This constitutes a significant breaking change and should be resolved as such by upstream Anaconda repositories.

Somebody disastrously broke backward compatibility, guys. </shaking_my_head>

mattwthompson added a commit to mosdef-hub/mbuild that referenced this issue Jun 27, 2019
See #556 (review) for a summary

* Drop ipyext from conda recipe

* Make Appveyor output more verbose

* Also specify PYTHON_VERSION

* Enforce newer version of miniconda

* Activate base environment before conda-build

Small change necessary to run conda-build.

See conda/conda-build#3220 (comment)

* Use environment variables for python vesion

* Additonal test for conda environment

* force base environment to be activated before installing

* Pass environment variable through for python version

* activate base env first

* Enforce python version when calling conda-build

* Use different ordering of conda-build args
3ll3d00d added a commit to 3ll3d00d/beqdesigner that referenced this issue Jun 29, 2019
umesh-timalsina pushed a commit to mosdef-hub/molbox that referenced this issue Jun 26, 2021
See mosdef-hub/mbuild#556 (review) for a summary

* Drop ipyext from conda recipe

* Make Appveyor output more verbose

* Also specify PYTHON_VERSION

* Enforce newer version of miniconda

* Activate base environment before conda-build

Small change necessary to run conda-build.

See conda/conda-build#3220 (comment)

* Use environment variables for python vesion

* Additonal test for conda environment

* force base environment to be activated before installing

* Pass environment variable through for python version

* activate base env first

* Enforce python version when calling conda-build

* Use different ordering of conda-build args
@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically locked because it has not had recent activity after being closed.

Please open a new issue if needed.

Thanks!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Mar 10, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

No branches or pull requests

7 participants