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

Conda is mixing 32-bit and 64-bit packages (platform is not stored in the conda environment) #1744

Closed
tadeu opened this issue Oct 27, 2015 · 13 comments
Assignees
Labels
locked [bot] locked due to inactivity

Comments

@tadeu
Copy link

tadeu commented Oct 27, 2015

There seems to be an inconsistency about the usage of CONDA_FORCE_32BIT.
This is in Windows, look at this sequence of commands:

$ set CONDA_FORCE_32BIT=1
$ conda create -n py32 python=2
$ activate py32
$ conda info | grep platform
             platform : win-32

$ deactivate py32
$ set CONDA_FORCE_32BIT=
$ activate py32
$ conda info | grep platform
             platform : win-64

$ python -c "import struct; print(8*struct.calcsize('P'))"
32

$ conda install numpy
$ python -c "import numpy"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  <...>
    from . import multiarray
ImportError: DLL load failed: %1 is not a valid Win32 application.

As you can see, it is currently brittle: if I forget this environment variable (this may be common if I have multiple environments, some in 64-bit and some in 32-bit), then conda will silently mix 64-bit packages with 32-bit packages.

It seems that CONDA_FORCE_32BIT should only be used at environment creation, and ignored on activation.

@msarahan
Copy link
Contributor

Yikes! Good catch, and thanks for the simple example. We will work on this as a high priority issue.

@msarahan msarahan self-assigned this Oct 27, 2015
@tadeu
Copy link
Author

tadeu commented Oct 27, 2015

Thanks! :)

@dschreij
Copy link

Is there any update on this? The CONDA_FORCE_32BIT variable is very sparsely documented in overall (as in I remembered it exists, but the first 10 Google terms that broadly described what I was looking for (e.g. "conda build force 32 bit) didn't deliver any hits on this).

@dusans
Copy link

dusans commented Feb 16, 2017

Would it be possible to add the architecture (32/64 bit) to the environment.yml? This would make the definition inside environment.yml complete?

The other options would maybe be to add another key in environment.yml

environment_variables:
    CONDA_FORCE_32BIT=1
    SOME_OTHER_VARIABLE=value
name: env_name
dependencies:
- python=2.7.13
- pip:
  - ipdb
  - cx-freeze

This (environment_variables) would be executed before everything else.

@AldoMaine
Copy link

Set up a 32bit python environment so I could run some legacy scripts in python 2.7
After activating this enviroment, when I try to start spyder I get this in the IPython window:

Traceback (most recent call last):
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 227, in
main()
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 200, in main
from ipykernel.kernelapp import IPKernelApp
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\ipykernel_init_.py", line 2, in
from .connect import *
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\ipykernel\connect.py", line 13, in
from IPython.core.profiledir import ProfileDir
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\IPython_init_.py", line 48, in
from .core.application import Application
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\IPython\core\application.py", line 25, in
from IPython.core import release, crashhandler
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\IPython\core\crashhandler.py", line 28, in
from IPython.core import ultratb
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\IPython\core\ultratb.py", line 124, in
from IPython.utils import path as util_path
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\IPython\utils\path.py", line 18, in
from IPython.utils.process import system
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\IPython\utils\process.py", line 15, in
from .process_win32 import system, getoutput, arg_split, check_pid
File "e:\Users\aldon\Anaconda2\envs\py27_32\lib\site‑packages\IPython\utils_process_win32.py", line 21, in
import ctypes
File "E:\Users\aldon\Anaconda2\Lib\ctypes_init
.py", line 7, in
from _ctypes import Union, Structure, Array
ImportError: DLL load failed: %1 is not a valid Win32 application.

It looks like the interpreter is forgetting that it is supposed to be using the 32 bit environment and is defaulting back to my root environment which is 64 bit.

@mingwandroid
Copy link
Contributor

IMHO all this CONDA_FORCE_32BIT stuff needs to go away and be replaced with being able to have an arbitrary platform declared for each environment (internally the platforms are usually called subdirs).

Why shouldn't someone on Windows be able to install and try an environment containing Linux software under Windows Subsystem for Linux, or a Linux or macOS user be able to do the same using Wine?

Sure many things won't work well and we'd probably not have time to look into such esoteric setups, but internally we need to be able to do this anyway to support cross-compilation.

cc @kalefranz.

@mingwandroid
Copy link
Contributor

@AldoMaine, your best way to avoid issues currently is to install the 32-bit Miniconda and run it from C:\Windows\SysWOW64\cmd.exe.

This will avoid all sorts of potential problems.

@AldoMaine
Copy link

Thanks. Miniconda and SysWOW64 did the trick. Now if I can just get out of dll hell....

@mingwandroid
Copy link
Contributor

Can I suggest Linux or macOS? ;-) (I say that jokingly as a big fan of Windows though)

@AldoMaine
Copy link

No doubt Linux would be better for this task (and many others). Unfortunately I've been on the Microsoft bandwagon for so many years it's hard to get off. Maybe I need virtual machines so I can use the OS that best fits the task. I recently installed Debian Linux on an older PC to explore it's capabilities but my main rig runs Windows 10.

@kalefranz
Copy link
Contributor

@mingwandroid has it right that CONDA_FORCE_32BIT will be going away. Instead, the override behavior will be explicitly setting desired subdirs. Right now in 4.3.latest I think it's CONDA_SUBDIR=win-32 would usually work on windows. In the future, the more general case will be something like CONDA_SUBDIRS=win-32,noarch, and we'll also be working on reducing package cache collisions between both channels and subdirs. Right now, to avoid package cache churn, you can also set CONDA_PKGS_DIRS, which is now independent and decoupled from CONDA_ENVS_DIRS.

coldfix added a commit to hibtc/cpymad that referenced this issue Feb 14, 2019
coldfix added a commit to hibtc/cpymad that referenced this issue Feb 15, 2019
coldfix added a commit to hibtc/cpymad that referenced this issue Feb 15, 2019
coldfix added a commit to hibtc/cpymad that referenced this issue Feb 15, 2019
@Mirajul-Mohin
Copy link

How to use it in ubuntu 16.04?

@github-actions
Copy link

Hi there, thank you for your contribution to Conda!

This issue has been automatically locked since it has not had recent activity after it was closed.

Please open a new issue if needed.

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 30, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2021
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

8 participants