Trying to install pymongo on ubuntu 12.04 - mongodb

Background Information:
Hi there. I'm trying to get mongodb and python (2.7.8) working on my ubuntu 12.04 box.
I've got mongodb installed and running...
I *think I have python set up too. Now I'm trying to install pymongo.
Problem
When I try to install pymongo, this is what i get:
me#mydev:~/Documents/Python-2.7.8$ pip install pymongo
Downloading/unpacking pymongo
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pymongo
No distributions at all found for pymongo
Storing complete log in /home/me/.pip/pip.log
me#mydev:~/Documents/Python-2.7.8$
The log file pip.log looks like this: http://pastebin.com/15wv38kf
Based on the logs, tt *seems like I need to update the repositories to look for the package in a different URL... but I'm not sure what library / url to add.
Other things I've tested / checked:
Retrieved updated package list:
sudo apt-get update
Proved that python 2.7.8 is installed:
me#medev:~/Documents/Python-2.7.8$ python
Python 2.7.8 (default, Nov 5 2014, 15:18:10)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Proved that PIP is installed:
me#medev:~/Documents/Python-2.7.8$ pip
Usage: pip COMMAND [OPTIONS]
pip: error: You must give a command (use "pip help" to see a list of commands)
me#medev:~/Documents/Python-2.7.8$
Proved that mongodb is installed (but apparently not setup properly!):
me#medev:~/Documents/Python-2.7.8$ mongo
MongoDB shell version: 2.6.5
connecting to: test
2014-11-06T08:23:47.444-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2014-11-06T08:23:47.444-0500 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
me#medev:~/Documents/Python-2.7.8$
Any suggestions would be appreciated.
EDIT 1
I tried to just install using the package manager as suggested, but that doesn't seem to work. Please see the results at: http://pastebin.com/V56KXzFT
Perhaps my test to prove pymongo is installed is faulty?
EDIT 2
I can't remember now but I think by default Ubuntu 12.0.4 comes with python 2.7.3 or something like that. But I'm doing a course, and it requires 2.7.8.
Initially, I downloaded a zip file for python 2.7.6 and saved it in my Documents folder...
I extracted it and ran
./compile
make
make install
then I realized that I needed 2.7.8 and so I did the same thing. Downloaded the zip ... and
compiled.
This is the link that I used as a reference to install 2.7.8:
https://askubuntu.com/questions/101591/how-do-i-install-python-2-7-2-on-ubuntu
Could this be related to the issue?

"pip install pymongo" works fine on my Linux box:
$ sudo pip install pymongo
Downloading/unpacking pymongo
Downloading pymongo-2.7.2.tar.gz (381kB): 381kB downloaded
Running setup.py (path:/tmp/pip_build_root/pymongo/setup.py) egg_info for package pymongo
Installing collected packages: pymongo
Running setup.py install for pymongo
building 'bson._cbson' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/local/include/python2.7 -c bson/_cbsonmodule.c -o build/temp.linux-x86_64-2.7/bson/_cbsonmodule.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/local/include/python2.7 -c bson/time64.c -o build/temp.linux-x86_64-2.7/bson/time64.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/local/include/python2.7 -c bson/buffer.c -o build/temp.linux-x86_64-2.7/bson/buffer.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/local/include/python2.7 -c bson/encoding_helpers.c -o build/temp.linux-x86_64-2.7/bson/encoding_helpers.o
gcc -pthread -shared -Wl,-rpath /usr/local/lib build/temp.linux-x86_64-2.7/bson/_cbsonmodule.o build/temp.linux-x86_64-2.7/bson/time64.o build/temp.linux-x86_64-2.7/bson/buffer.o build/temp.linux-x86_64-2.7/bson/encoding_helpers.o -L/usr/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/bson/_cbson.so
building 'pymongo._cmessage' extension
< ... snip ... >
Successfully installed pymongo
Cleaning up...
I'd guess it failed for you because, perhaps, you first must upgrade "pip" itself.
I notice you've tried various methods of installing PyMongo, and some methods work but when you do "import pymongo" in Python it fails. Here, I guess that you have multiple version of Python installed, and that your default Python is different from the system Python for which PyMongo was installed.

Related

Error Installing AGE from Source Code on Mac

I am trying to install AGE on my system running macOS 12.6.3 using this guide. I am getting an error on the step I try to make PG_CONFIG=/path/to/postgres/bin/pg_config install and am unsure how to get it fixed.
Here are the series of Terminal lines:
kenwoon#Kens-MacBook-Pro age-1.1.0-rc0 % make PG_CONFIG=/Users/kenwoon/Downloads/postgresql-12.14/src/bin/pg_config/pg_config install
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I.//src/include -I.//src/include/parser -I. -I./ -I/usr/local/pgsql/include/server -I/usr/local/pgsql/include/internal -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -c -o src/backend/age.o src/backend/age.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I.//src/include -I.//src/include/parser -I. -I./ -I/usr/local/pgsql/include/server -I/usr/local/pgsql/include/internal -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -c -o src/backend/catalog/ag_catalog.o src/backend/catalog/ag_catalog.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2 -I.//src/include -I.//src/include/parser -I. -I./ -I/usr/local/pgsql/include/server -I/usr/local/pgsql/include/internal -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -c -o src/backend/catalog/ag_graph.o src/backend/catalog/ag_graph.c
src/backend/catalog/ag_graph.c:67:15: error: assigning to 'Oid' (aka 'unsigned int') from incompatible type 'void'
graph_oid = CatalogTupleInsert(ag_graph, tuple);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [src/backend/catalog/ag_graph.o] Error 1
In order to install the extension for PostgreSQL 12 you will need to checkout branch AGE_PG12.1.0_ALPHA and then run the installer
First of all Apache Age works fine with PostgreSQL 11. If you can I would recommend using PostgreSQL 11. Moreover follow the tutorial from Apache Age official site
Steps to install Apache Age on MacOs.
First install postgresql
Download the bz2 file. Postgresql 11.17 works well with apache age.
Unzip the file using tar
Run the command "./configure" with optional parameters as mentioned in the video.
run sudo make install
Then you need to install apache age. The link is given below
https://youtu.be/0-qMwpDh0CA
Try to install apache age with postgresql 11
and use these flags for configuration:
./configure --enable-debug --enable-cassert --prefix=$(pwd) CFLAGS="-glldb -ggdb -Og -g3 -fno-omit-frame-pointer"
This video is the good source to install apache age on macOS.
The issue is with the master branch of age, I think some development code was merged by mistake. To be absolutely sure that you are trying to install working age extension, use the release source code.
I had already faced this issue on my macbook pro m1. But after checking all that tutorials, that problem isn't solved because of it needs step by step compilation. If you broke or miss any steps, then the projects failed to be opened.
I am implemented terminal and AGE-Viewer both way. I will give you proper direction how to avoid this error. Thanks
#apacheage #postgresql
https://age.apache.org/ https://github.com/apache/age
Successfully connected on macbook pro m1
I faced the exact same situation while being on Linux where the 'pg_config' file was in subdirectory 'pg_config' of directory 'src/bin'. This issue will be resolved if you install the postgresql server-side development files using the command :
sudo apt install postgresql-server-dev-all
Then download the tar file to install postgres which will be extracted to your current directory. (Note install postgres 11 instead of 12)
wget https://ftp.postgresql.org/pub/source/v11.18/postgresql-11.18.tar.gz && tar -xvf postgresql-11.18.tar.gz && rm -f postgresql-11.18.tar.gz
After this, install psql using the ./configure command, I would recommend enabling the debugging flag. To read more on the flags, read the Doc. pwd will install postgres in the current directory. You might need to look for the exact ./configure command for macOS.
cd postgresql-11.18
./configure --enable-debug --enable-cassert --prefix=$(pwd) CFLAGS="-ggdb -Og -fno-omit-frame-pointer"
make install
cd ../../
This should install postgreSQL to your system.
I hope it helps.
References
Blog

"python3 setup.py sdist" hangs

I am packaging up a python package, but the command
python3 setup.py sdist
is hanging.
Previously this worked without any problems, but now it hangs while doing:
/usr/bin/gfortran -Wall -g -Wall -g -shared /tmp/tmpm0rbalgy/tmp/tmpm0rbalgy/src.linux-x86_64-3.6/_tortmodule.o /tmp/tmpm0rbalgy/tmp/tmpm0rbalgy/src.linux-x86_64-3.6/fortranobject.o /tmp/tmpm0rbalgy/f90wrap_tort.o tort.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7 -lgomp -lgfortran -o ./_tort.cpython-36m-x86_64-linux-gnu.so
Removing build directory /tmp/tmpm0rbalgy
The build directory has certainly been removed, so I'm not sure why it is getting stuck here.

How to install ruamel.yaml w/o native extension

I'd like to install ruamel.yaml on an environment which does not have a compiler, and I do not care about the performances.
What is the proper way to install ruamel.yaml w/o pip trying to build the extension and failing to execute the C compiler which is not installed?
I ran
pip3 install ruamel.yaml
which failed with
building '_ruamel_yaml' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/ext
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.6m -c ext/_ruamel_yaml.c -o build/temp.linux-x86_64-3.6/ext/_ruamel_yaml.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-myos8iv1/ruamel.yaml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vuvr4aoi/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-myos8iv1/ruamel.yaml/
Testing if compilation worked and skipping compiling the C extensions if it didn't, was removed from ruamel.yaml when it was no longer dependent on libyaml being available.
That of course doens't mean that the C compiler is available, so this should be considered a regression. In ruamel.yaml>=0.15.41 this should be fixed.

Error building doxygen1.8.6

Just got the latest duoxygen 1.8.6 on Linux
Currently have 1.8.5 installed. It build fine.
With 1.8.6 am gettign the following error:
gmake[2]: Entering directory `/home/build/doxygen/doxygen-1.8.6/src'
/usr/bin/flex -PconfigYY -t config.l >config.cpp
g++ -c -pipe -fsigned-char -D_LARGEFILE_SOURCE -Wall -W -O2 -I../qtools -o ../objects/config.o config.cpp
config.l: In member function bool Config::parse(const char*):
config.l:1692: error: configYY_flex_debug was not declared in this scope
gmake[2]: *** [../objects/config.o] Error 1
Any help appreciated
With release 1.8.6 a newer version of flex is required to build doxygen. Try version 2.5.35 or later.
See also https://bugzilla.gnome.org/show_bug.cgi?id=719525

Scons in Mongodb

When i run scons --ssl all, it throws an error:
g++ -o build/linux2/release/ssl/mongo/util/net/ssl_manager.o -c
-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wno-unknown-pragmas -Winvalid-pch -pipe -fno-builtin-memcmp -O3 -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -D_FILE_OFFSET_BITS=64 -DMONGO_SSL -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -DNETSNMP_NO_INLINE -Ibuild/linux2/release/ssl/third_party/libstemmer_c/include -Isrc/third_party/libstemmer_c/include -Ibuild/linux2/release/ssl/third_party/s2 -Isrc/third_party/s2 -Ibuild/linux2/release/ssl/third_party/boost -Isrc/third_party/boost -Ibuild/linux2/release/ssl/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/linux2/release/ssl -Isrc -Ibuild/linux2/release/ssl/mongo -Isrc/mongo -Ibuild/linux2/release/ssl/third_party/s2 -Isrc/third_party/s2 -Ibuild/linux2/release/ssl/third_party/snappy -Isrc/third_party/snappy -Ibuild/linux2/release/ssl/third_party/v8/include -Isrc/third_party/v8/include src/mongo/util/net/ssl_manager.cpp
src/mongo/util/net/ssl_manager.cpp: In member function 'void
mongo::SSLManager::_setupFIPS()':
src/mongo/util/net/ssl_manager.cpp:187: error: 'FIPS_mode_set' was not
declared in this scope scons: *
[build/linux2/release/ssl/mongo/util/net/ssl_manager.o] Error 1 scons:
building terminated because of errors.
How to fix this issue. Using Ubuntu 12.04
To address this error make sure that you have a version of OpenSSL installed that defines FIPS_mode_set. Some versions of 0.9.8 for example don't. Upgrading to 1.0.1 should address.
If you are already on 1.0.1 make sure that correct OpenSSL headers and libraries are being used by scons. You can set explicitly by adding the include and lib paths as a command line arguments, as follows:
scons --ssl --cpppath /usr/local/openssl/1.0.1e/include --libpath /usr/local/openssl/1.0.1e/lib all
Where the paths provided are the actual paths of your OpenSSL include and libraries.
For those who have the same issue with OSX on Mac. Here is what you need to include:
scons --ssl --cpppath=/usr/local/opt/openssl/include --libpath=/usr/local/opt/openssl/lib all
assuming you've downloaded openssl with brew
brew install openssl