4

The official instructions only talk about conda:

https://www.pymc.io/projects/docs/en/latest/installation.html

I'm trying to put pymc into a docker image and I don't want to use conda in the docker image.

I just added pymc to requirements.txt, which gets pip installed in my python3.9 docker image (it's a proprietary image, not on dockerhub, unfortunately). The dockerfile builds, and I can run the example in the quickstart:

import numpy as np
import pymc as pm
print(f"Running on PyMC3 v{pm.__version__}")
alpha, sigma = 1, 1
beta = [1, 2.5]

# Size of dataset
size = 100

# Predictor variable
X1 = np.random.randn(size)
X2 = np.random.randn(size) * 0.2

# Simulate outcome variable
Y = alpha + beta[0] * X1 + beta[1] * X2 + np.random.randn(size) * sigma
basic_model = pm.Model()
with basic_model:
    # Priors for unknown model parameters
    alpha = pm.Normal("alpha", mu=0, sigma=10)
    beta = pm.Normal("beta", mu=0, sigma=10, shape=2)
    sigma = pm.HalfNormal("sigma", sigma=1)

    # Expected value of outcome
    mu = alpha + beta[0] * X1 + beta[1] * X2

    # Likelihood (sampling distribution) of observations
    Y_obs = pm.Normal("Y_obs", mu=mu, sigma=sigma, observed=Y)

map_estimate = pm.find_MAP(model=basic_model)
map_estimate

So here is my question: will something break if I install with pip?

If it works for this example, is it fine? Or will something about the numerical libraries be wrong? I've gotten the following error with a direct github install of pymc3, and manually installed mkl:

enter image description here

I get no such error with my installation of version 4, but the one above is sufficiently worrisome that I figure it's worth checking.

The documentation on the install page says nothing about why you should use conda, or the risks of not doing so. Hence my question.

generic_user
  • 3,430
  • 3
  • 32
  • 56

0 Answers0