James
James

Reputation: 4050

Conda Packages Need Conflicting Numpy Versions

I'm working on a shared Python project using conda to manage dependencies.

I have two libraries that are causing me a problem, openCV and python-pcl.

openCV requires numpy 1.7.*. There is only one conda package that I can see:

>conda search -f opencv
Fetching package metadata .........
opencv                    *  2.4.8                np17py27_2  defaults  

python-pcl requires numpy 1.9.* to work correctly (as far as I can tell). There is also only one conda package:

>conda search -c ccordoba12 python-pcl
Fetching package metadata ...........
python-pcl                *  0.2                    nppy27_1  ccordoba12  

With numpy 1.7.1 installed the following python-pcl code gives an error:

import pcl
import numpy as np


def main():
    p = pcl.PointCloud(np.array([[1, 2, 3], [3, 4, 5]], dtype=np.float32))
    seg = p.make_segmenter()
    seg.set_model_type(pcl.SACMODEL_PLANE)
    seg.set_method_type(pcl.SAC_RANSAC)
    indices, model = seg.segment()

if __name__ == '__main__':
    main()

The error is:

  import pcl
  File "/Users/MyName/anaconda/envs/MyDir/lib/python2.7/site-packages/pcl/__init__.py", line 2, in <module>
    from ._pcl import *
  File "__init__.pxd", line 861, in init pcl._pcl (pcl/_pcl.cpp:15775)
ValueError: numpy.ufunc has the wrong size, try recompiling

Is there a neat way that I can solve this problem so that I can share my environment with my colleagues?

Here is my environment.yml file:

name: TestEnv
channels:
- ccordoba12
- defaults
dependencies:
- boost=1.55.0=2
- eigen3=3.2.5=0
- flann=1.8.4=0
- icu=54.1=1
- pcl=1.7.2=3
- python-pcl=0.2=nppy27_1
- dateutil=2.4.1=py27_0
- freetype=2.4.10=1
- libpng=1.5.13=1
- matplotlib=1.3.1=np17py27_0
- numpy=1.7.1=py27_2
- opencv=2.4.8=np17py27_2
- openssl=1.0.2l=0
- pip=9.0.1=py27_1
- pyparsing=1.5.6=py27_0
- python=2.7.13=0
- pytz=2017.2=py27_0
- readline=6.2=2
- scipy=0.13.2=np17py27_1
- setuptools=27.2.0=py27_0
- six=1.10.0=py27_0
- sqlite=3.13.0=0
- tk=8.5.18=0
- wheel=0.29.0=py27_0
- zlib=1.2.8=3
- pip:
  - python-dateutil==2.4.1
prefix: /Users/me/anaconda/envs/TestEnv

Upvotes: 0

Views: 781

Answers (1)

Sraw
Sraw

Reputation: 20214

I think maybe you should install another version of opencv.

Try this:

conda search -c conda-forge opencv

https://anaconda.org/conda-forge/opencv

Upvotes: 2

Related Questions