Numpy and matplotlib without compiling/building in virtualenv - numpy

I'm trying to set up virtualenv with numpy. I've found that the recommended way to do it is by using
python setup.py install
in the numpy directory while under virtual enviroment.
I was wondering if it's possible to avoid the fortran compiling and just use a numpy binary available for OS?
Has anyone tried this? I couldn't figure out where is numpy located.
UPDATE:
Managed to do something.
Searched for "numpy" in my file system and found it in "usr/lib/pymodules/python2.7/numpy".
Then i just copied that to my virtualenv folder to "lib/pymodules/python2.7"
For now, i was able to call all numpy methods i tried.
UPDATE:
Tried to install matplotlib since numpy is a dependency for it. That failed:
REQUIRED DEPENDENCIES
numpy: 1.5.1
freetype2: found, but unknown version (no pkg-config)
* WARNING: Could not find 'freetype2' headers in any
* of '/usr/include', '.', '/usr/include/freetype2',
* './freetype2'.
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.tri', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil.zoneinfo']
warning: no files found matching 'KNOWN_BUGS'
warning: no files found matching 'INTERACTIVE'
warning: no files found matching 'MANIFEST'
warning: no files found matching '__init__.py'
warning: no files found matching 'examples/data/*'
warning: no files found matching 'lib/mpl_toolkits'
warning: no files found matching 'LICENSE*' under directory 'license'
In file included from ./CXX/Extensions.hxx:37:0,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
./CXX/WrapPython.h:58:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
It does seem so that it isn't numpy which is causing the errors. Trying to diagnose the cause of the error...
UPDATE:
Manually went through all REQUIRED DEPENDENCIES and installed them.
It flied by to fast so i didn't notice it, and believed it yielded no errors.

Probably you need python dev package. try this
sudo apt-get install python2.7-dev

Not sure what OS you're using, but I would just use an EPD Free binary for this. Granted, you get SciPy and some other stuff along with it, but it's about as hassle-free as you can get.

Related

Building C++ Pybind11 extension with setuptools and CMake generates .so directory

I am trying to use setuptools to install a C++ library with a Pybind11 interface using CMake. For using CMake with setuptools, I am using the code in the following answer: Extending setuptools extension to use CMake in setup.py?
I am able to build the library by hand with cmake.
Unfortunately however, when executing pip install . in the root directory of my project, the build fails.
While the first call to cmake (self.spawn(['cmake', str(cwd)] + cmake_args)) finishes without any error, executing the second call (self.spawn(['cmake', '--build', '.'] + build_args)) gives me the following error:
/users/thoerman/miniconda3/envs/postproc_np_products/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot open output file /users/thoerman/postproc_np_products/build/lib.linux-x86_64-cpython-37/postproc_ops_cpp.cpython-37m-x86_64-linux-gnu.so: Is a directory
collect2: error: ld returned 1 exit status
gmake[3]: *** [/users/thoerman/postproc_np_products/build/lib.linux-x86_64-cpython-37/postproc_ops_cpp.cpython-37m-x86_64-linux-gnu.so] Error 1
gmake[2]: *** [CMakeFiles/postproc_ops_cpp.dir/all] Error 2
gmake[1]: *** [CMakeFiles/postproc_ops_cpp.dir/rule] Error 2
gmake: *** [postproc_ops_cpp] Error 2
But when running the exact same commands on the command line inside the build_temp directory, everything works just fine.
Does anyone have a hint for me, what might be going wrong?
After further digging into the problem, I found the solution myself.
The problem was with the lines
extdir = pathlib.Path(self.get_ext_fullpath(ext.name))
extdir.mkdir(parents=True, exist_ok=True)
This created a directory for the target to be built. Building the target then failed, since there was already a directory with the same name.
I was able to solve it by replacing the second line as follows:
extdir.parent.mkdir(parents=True, exist_ok=True)

Unable to load fasttext-wiki-news-subswords-300

Starting with the gensim api:
import gensim.downloader as api
api.load('fasttext-wiki-news-subwords-300')
I get the error:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/user.name/gensim-data/fasttext-wiki-news-subwords-300/fasttext-wiki-news-subwords-300.gz'
I also tried the cli:
python3 -m gensim.downloader --download fasttext-wiki-news-subwords-300
and when I check the ~/gensim-data/fasttext-wiki-news-subwords-300 folder it only contains:
__init__.py
__pycache__
Have there been any changes to the to api or the dataset in the last few months?
Note
I am using Python3.8 and gensim==4.2.0
I have checked that the Certificates are Installed ('Install Certificates.command').
I ended up deleting the ~/gensim-data folder and downgraded gensim to 3.8.3, seems to be working now. Leaving the question and answer here as (1) error message was a red herring and (2) solution was not straightforward.

Error installing MoveIt 2 from source on Ubuntu 20.04 VM

I'm trying to get involved in open source and also am quite interested in robotics, so I thought about contributing to MoveIt 2. As a first step, I'm installing MoveIt 2 from source on my Ubuntu 20.04 VM in VirtualBox.
I've run through all the instructions here: https://moveit.ros.org/install-moveit2/source/#:~:text=colcon%20build%20%2D%2Devent%2Dhandlers%20desktop_notification%2D%20status%2D%20%2D%2Dcmake%2Dargs%20%2DDCMAKE_BUILD_TYPE%3DRelease
However, the build is failing on the highlighted part. The error message is as follows:
Starting >>> geometric_shapes
--- stderr: geometric_shapes
CMake Error at CMakeLists.txt:47 (find_package):
By not providing "Findeigen3_cmake_module.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"eigen3_cmake_module", but CMake did not find one.
Could not find a package configuration file provided by
"eigen3_cmake_module" with any of the following names:
eigen3_cmake_moduleConfig.cmake
eigen3_cmake_module-config.cmake
Add the installation prefix of "eigen3_cmake_module" to CMAKE_PREFIX_PATH
or set "eigen3_cmake_module_DIR" to a directory containing one of the above
files. If "eigen3_cmake_module" provides a separate development package or
SDK, be sure it has been installed.
---
Failed <<< geometric_shapes [1.20s, exited with code 1]
Summary: 0 packages finished [1.46s]
1 package failed: geometric_shapes
1 package had stderr output: geometric_shapes
33 packages not processed
Any help is really appreciated. Thanks!
You have to install ROS2 before building Move It 2. After installing the ROS2 binaries, the error doesn't occur.

Error while building Tensorflow using bazel

I'm currently following the instructions here
to build tensorflow from source using bazel.
After setting up the configuration, and attempting to build it, I get this error:
Cuda Configuration Error: Error reading C:/Program Files/NVIDIA GPU
Computing To olkit/CUDA/v9.0/include/cudnn.h: java.io.IOException:
ERROR: src/main/native/win dows/processes-jni.cc(239):
CreateProcessW("grep" --color=never -A1 -E "#define CUDNN_MAJOR"
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/include/cu
dnn.h"): Das System kann die angegebene Datei nicht finden.
The last phrase translates to "no such file or directory".
But I'm 100% sure I installed cuDNN 7.1.2 correctly, merging the downloaded bin/include/lib folder's with the preexisting CUDA folders. If I copy/paste the path from the error message, there it is cudnn.h! I also run everything in administator etc..
This problem shows up a few times on google, linking it to a mis-configured theano setup, but I'm not using theano right now.
Why doesn't bazel find the file, when it's definitely there?
EDIT: I would also be very thankful if anyone has a link a pre-built version of tensorflow for CUDA compute capability 3.0!
Thank you in advance!
The error indicated that grep.exe can't be found. I tried grep for Windows and msys2. Both will do.

Debian package bug on squeeze?

My hand-made debian package wont install if i build it on Squeeze (well, a squeezechroot)?
If i built it on a wheezy box though it builds installable packages.
Note that it builds fine in either case. Im generating the debian packages using CMake/CPack.
The error message i get is:
user#buildbox:/builddir/packagename# dpkg -i packagename_1.0.3.deb
(Reading database ... 35116 files and directories currently installed.)
Unpacking packagename (from packagename_1.0.3.deb) ...
dpkg: error processing packagename_1.0.3.deb (--install):
unable to create `/usr/share/packagename/builddir/mixer_devices.txt.dpkg-new' (while processing `./usr/share/packagename/builddir/mixer_devices.txt'): No such file or directory
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
packagename_1.0.3.deb
Might it be that mixer_devices is not contained within the created deb file for some reason?
Just do an ar x packagename_1.0.3.deb and see what the tar file contains.