在Ubuntu上安装Monary 0.4时出错

时间:2015-09-08 22:11:31

标签: python mongodb ubuntu mongo-c-driver

我一直在尝试在运行Ubuntu 14.04.1 LTS的VM上安装Monary失败。 我安装了Mongo C驱动程序,我认为已经正确完成了。

全文道歉。

[更新:启用ssl和sasl使用:

sudo apt-get install -y libsasl2-dev libssl-dev

然后

./configure --enable-ssl --enable-sas

使用

sudo pip install monary #or even without sudo

[now]给出:

Downloading/unpacking monary
  Downloading Monary-0.4.0.post2.tar.gz
  Running setup.py (path:/tmp/pip_build_root/monary/setup.py) egg_info for package monary

    warning: no previously-included files matching '*.py' found under directory 'test'
    warning: no previously-included files matching '*.py' found under directory 'timing'
Installing collected packages: monary
  Running setup.py install for monary
    building 'monary.libcmonary' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0 -I/usr/include/python2.7 -c monary/cmonary.c -o build/temp.linux-x86_64-2.7/monary/cmonary.o -fPIC -O2 -DNDEBUG
    monary/cmonary.c: In function ‘monary_connect’:
    monary/cmonary.c:130:9: error: unknown type name ‘mongoc_ssl_opt_t’
             mongoc_ssl_opt_t opts = { pem_file, pem_pwd, ca_file, ca_dir, crl_file,
             ^
    monary/cmonary.c:130:9: warning: initialization makes integer from pointer without a cast [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:132:9: warning: excess elements in scalar initializer [enabled by default]
             };
             ^
    monary/cmonary.c:132:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:133:9: warning: implicit declaration of function ‘mongoc_client_set_ssl_opts’ [-Wimplicit-function-declaration]
             mongoc_client_set_ssl_opts(client, &opts);
             ^
    monary/cmonary.c: In function ‘monary_load_query’:
    monary/cmonary.c:1018:9: warning: variable ‘total_values’ set but not used [-Wunused-but-set-variable]
         int total_values;
             ^
    monary/cmonary.c: In function ‘monary_insert’:
    monary/cmonary.c:1374:11: warning: unused variable ‘str’ [-Wunused-variable]
         char *str;
               ^
    monary/cmonary.c:1368:25: warning: unused variable ‘citem’ [-Wunused-variable]
         monary_column_item *citem;
                             ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/monary/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-2kCMXO-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/monary

copying monary/ordereddict.py -> build/lib.linux-x86_64-2.7/monary

copying monary/monary.py -> build/lib.linux-x86_64-2.7/monary

copying monary/monary_param.py -> build/lib.linux-x86_64-2.7/monary

copying monary/datehelper.py -> build/lib.linux-x86_64-2.7/monary

copying monary/__init__.py -> build/lib.linux-x86_64-2.7/monary

copying monary/write_concern.py -> build/lib.linux-x86_64-2.7/monary

running build_ext

building 'monary.libcmonary' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/monary

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0 -I/usr/include/python2.7 -c monary/cmonary.c -o build/temp.linux-x86_64-2.7/monary/cmonary.o -fPIC -O2 -DNDEBUG

monary/cmonary.c: In function ‘monary_connect’:

monary/cmonary.c:130:9: error: unknown type name ‘mongoc_ssl_opt_t’

         mongoc_ssl_opt_t opts = { pem_file, pem_pwd, ca_file, ca_dir, crl_file,

         ^

monary/cmonary.c:130:9: warning: initialization makes integer from pointer without a cast [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:132:9: warning: excess elements in scalar initializer [enabled by default]

         };

         ^

monary/cmonary.c:132:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:133:9: warning: implicit declaration of function ‘mongoc_client_set_ssl_opts’ [-Wimplicit-function-declaration]

         mongoc_client_set_ssl_opts(client, &opts);

         ^

monary/cmonary.c: In function ‘monary_load_query’:

monary/cmonary.c:1018:9: warning: variable ‘total_values’ set but not used [-Wunused-but-set-variable]

     int total_values;

         ^

monary/cmonary.c: In function ‘monary_insert’:

monary/cmonary.c:1374:11: warning: unused variable ‘str’ [-Wunused-variable]

     char *str;

           ^

monary/cmonary.c:1368:25: warning: unused variable ‘citem’ [-Wunused-variable]

     monary_column_item *citem;

                         ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/monary/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-2kCMXO-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/monary
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 34: ordinal not in range(128)

我已经尝试重新安装/更新一些似乎相关的软件包,但没有任何工作,我无法确定问题。

任何帮助表示赞赏。谢谢!

3 个答案:

答案 0 :(得分:2)

我今天遇到了同样的问题。我通过引用此页面成功安装了monary -0.5.0:

http://mongoc.org/libmongoc/current/installing.html     (我的操作系统是Ubuntu 16.04)

$ sudo apt-get install pkg-config libssl-dev libsasl2-dev
$ wget https://github.com/mongodb/mongo-c-driver/releases/download/1.9.2/mongo-c-driver-1.9.2.tar.gz
$ tar xzf mongo-c-driver-1.9.2.tar.gz
$ cd mongo-c-driver-1.9.2
$ ./configure --disable-automatic-init-and-cleanup
$ make
$ sudo make install
$ pip install pymongo monary  #install monary

答案 1 :(得分:1)

以下是安装Monary的详细步骤,从我刚从头开始使用Vagrant建立的完全库存的Ubuntu 14.04虚拟机开始:

$ sudo apt-get -qq install -y build-essential pkg-config libsasl2-dev libssl-dev python-dev python-numpy python-pip
$ curl -LOs https://github.com/mongodb/mongo-c-driver/releases/download/1.1.10/mongo-c-driver-1.1.10.tar.gz
$ tar zxf mongo-c-driver-1.1.10.tar.gz
$ cd mongo-c-driver
$ ./configure --enable-ssl --enable-sasl
< ... output ... >
libmongoc was configured with the following options:

  SASL                                             : sasl2
  SSL                                              : yes
$ make -j8 && sudo make install
< ... output ... >
$
$ # Prove we built with SSL:
$
$ grep mongoc_ssl_opt_t /usr/local/include/libmongoc-1.0/mongoc-ssl.h
typedef struct _mongoc_ssl_opt_t mongoc_ssl_opt_t;
struct _mongoc_ssl_opt_t
const mongoc_ssl_opt_t *mongoc_ssl_opt_get_default (void) BSON_GNUC_CONST;
$
$ nm /usr/local/lib/libmongoc-1.0.so | grep set_ssl
000000000000bdb0 T mongoc_client_pool_set_ssl_opts
000000000000b1f0 T mongoc_client_set_ssl_opts
$
$ sudo pip install pkgconfig # optional
Successfully installed pkgconfig
$ sudo pip install pymongo monary 
< ... output ... >
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import monary
>>> monary.version
'0.4.0'

答案 2 :(得分:1)

在Ubuntu上安装Monary - 在终端类型中输入以下内容:

  1. sudo apt-get install libbson-1.0
  2. sudo apt-get install libmongoc-1.0-0
  3. sudo apt-get install pkg-config libssl-dev libsasl2-dev
  4. wget https://github.com/mongodb/mongo-c-driver/releases/download/1.6.2/mongo-c-driver-1.6.2.tar.gz
  5. tar xzf mongo-c-driver-1.6.2.tar.gz
  6. cd mongo-c-driver-1.6.2
  7. ./ configure --disable-automatic-init-and-cleanup
  8. 使
  9. sudo make install
  10. sudo apt-get install git gcc automake autoconf libtool
  11. sudo -H pip3 install monary