Spinning up Development Environment

Recently, I ran into a few problems while spinning up a local development environment. Hopefully this will help out people in the future.

The first issue that I ran into was with ZeroMQ. The CentOS image that I had didn’t have a gcc compiler so I ended up finding a github issue for the project that outlines how to manually make the installation. For the record, the warning that I ran into looked something like this

warning: no previously-included files matching 'Makefile.in' found anywhere in distribution
Did not find libzmq via pkg-config.
{'libraries': ['zmq'], 'extra_link_args': [], 'runtime_library_dirs': [], 'library_dirs': [], 'include_dirs': []}
unable to execute gcc: No such file or directory
Warning: No sys/un.h, IPC_PATH_MAX_LEN will be undefined: command 'gcc' failed with exit status 1
************************************************
Configure: Autodetecting ZMQ settings...
    Custom ZMQ dir:
unable to execute cc: No such file or directory
unable to execute gcc: No such file or directory

error: command 'gcc' failed with exit status 1

Failed with default libzmq, trying again with /usr/local
{'libraries': ['zmq'], 'extra_link_args': [], 'runtime_library_dirs': [], 'library_dirs': ['/usr/local/lib'], 'include_dirs': ['/usr/local/include']}
************************************************
Configure: Autodetecting ZMQ settings...
    Custom ZMQ dir:       /usr/local
unable to execute cc: No such file or directory
unable to execute gcc: No such file or directory

error: command 'gcc' failed with exit status 1

************************************************
Warning: Couldn't find an acceptable libzmq on the system.

If you expected pyzmq to link against an installed libzmq, please check to make sure:

    * You have a C compiler installed
    * A development version of Python is installed (including headers)
    * A development version of ZMQ >= 3.2 is installed (including headers)
    * If ZMQ is not in a default location, supply the argument --zmq=<path>
    * If you did recently install ZMQ to a default location,
      try rebuilding the ld cache with `sudo ldconfig`
      or specify zmq's location with `--zmq=/usr/local`

You can skip all this detection/waiting nonsense if you know
you want pyzmq to bundle libzmq as an extension by passing:

    `--zmq=bundled`

I will now try to build libzmq as a Python extension
unless you interrupt me (^C) in the next 10 seconds...

 1...
************************************************
Using bundled libzmq
already have bundled/zeromq
attempting ./configure to generate platform.hpp
Warning: failed to configure libzmq:
/bin/sh: ./configure: No such file or directory

staging platform.hpp from: /tmp/easy_install-ZrCH9i/pyzmq-15.0.0/buildutils/include_linux
************************************************
checking for timer_create
unable to execute cc: No such file or directory
no timer_create, linking librt
************************************************
Using bundled libsodium
already have bundled/libsodium
already have crypto_scalarmult_curve25519.h
already have crypto_stream_salsa20.h
staging /tmp/easy_install-ZrCH9i/pyzmq-15.0.0/buildutils/include_sodium/version.h to bundled/libsodium/src/libsodium/include/sodium/version.h
************************************************
unable to execute gcc: No such file or directory
error: Setup script exited with error: command 'gcc' failed with exit status 1
An error occurred when trying to install /tmp/dist/pyzmq-15.0.0.zip. Look above this message for any errors that were output by easy_install.
While:
  Installing django.
  Getting distribution for 'pyzmq==15.0.0'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/opt/build/rockstor-core/eggs/zc.buildout-2.9.4-py2.7.egg/zc/buildout/buildout.py", line 2123, in main
    getattr(buildout, command)(args)
  File "/opt/build/rockstor-core/eggs/zc.buildout-2.9.4-py2.7.egg/zc/buildout/buildout.py", line 796, in install
    installed_files = self[part]._call(recipe.install)
  File "/opt/build/rockstor-core/eggs/zc.buildout-2.9.4-py2.7.egg/zc/buildout/buildout.py", line 1553, in _call
    return f()
  File "/opt/build/rockstor-core/eggs/djangorecipe-1.9-py2.7.egg/djangorecipe/recipe.py", line 67, in install
    requirements, ws = self.egg.working_set(['djangorecipe'])
  File "/opt/build/rockstor-core/eggs/zc.recipe.egg-2.0.4-py2.7.egg/zc/recipe/egg/egg.py", line 82, in working_set
    allow_hosts=self.allow_hosts,
  File "/opt/build/rockstor-core/eggs/zc.recipe.egg-2.0.4-py2.7.egg/zc/recipe/egg/egg.py", line 135, in _working_set
    allow_hosts=allow_hosts)
  File "/opt/build/rockstor-core/eggs/zc.buildout-2.9.4-py2.7.egg/zc/buildout/easy_install.py", line 913, in install
    return installer.install(specs, working_set)
  File "/opt/build/rockstor-core/eggs/zc.buildout-2.9.4-py2.7.egg/zc/buildout/easy_install.py", line 714, in install
    for dist in self._get_dist(req, ws):
  File "/opt/build/rockstor-core/eggs/zc.buildout-2.9.4-py2.7.egg/zc/buildout/easy_install.py", line 563, in _get_dist
    dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
  File "/opt/build/rockstor-core/eggs/zc.buildout-2.9.4-py2.7.egg/zc/buildout/easy_install.py", line 1699, in _move_to_eggs_dir_and_compile
    [tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
ValueError: need more than 0 values to unpack

Here is the issue that solved the problem. If the link dies, here are the instructions that it gives:

# I didn't have to do this step
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

# not sure if you need all of this
yum install -y git svn cpp make autoconf automake patch cmake wget mlocate rpm-build gcc-c++ uuid-devel pkgconfig libtool python-devel openpgm

# install zeromq. Make sure you aren't in your rockstor directory
wget http://download.zeromq.org/zeromq-4.0.5.tar.gz
tar xzvf zeromq-4.0.5.tar.gz
cd zeromq-4.0.5
./configure
make
make install

# install python pip
yum -y install python-pip

# install pyzmq
pip install pyzmq

Next, I ran into problems with the installation of psycopg2. The errors looked like this:

./psycopg/psycopg.h:31:22: fatal error: libpq-fe.h: No such file or directory

I solved this by installing the development package for Postgresql with this command

yum install postgresql-devel

After that I was good to go :slight_smile: