Unable to install tiktoken from PyPI - pypi

I am working on some OpenAI's API integrations. I am facing an issue while installing the tiktoken (a fast BPE tokeniser for use with OpenAI's models).
When I try to run on my macbook machine:
pip3 install tiktoken -v
It throws the following error (Using pip 22.3.1, error truncated because very long):
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
Perhaps try: xcode-select --install
*********************************************************************************
error: command '/usr/bin/clang' failed with exit code 1
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /Users/gianlucatrentin/gptenv/bin/python3 -u -c '
exec(compile('"'"''"'"''"'"'
# This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
#
# - It imports setuptools before invoking setup.py, to enable projects that directly
# import from `distutils.core` to work with newer packaging standards.
# - It provides a clear error message when setuptools is not installed.
# - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
# setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
# manifest_maker: standard file '"'"'-c'"'"' not found".
# - It generates a shim setup.py, for handling setup.cfg-only projects.
import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute `setup.py` since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)
__file__ = %r
sys.argv[0] = __file__
if os.path.exists(__file__):
filename = __file__
with tokenize.open(__file__) as f:
setup_py_code = f.read()
else:
filename = "<auto-generated setuptools caller>"
setup_py_code = "from setuptools import setup; setup()"
exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'/private/var/folders/sc/gl1552412gb0lg7_x33zrgj00000gn/T/pip-install-l7tec_bv/lxml_b78f1cdebea441d2b840e6957fabe83a/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d /private/var/folders/sc/gl1552412gb0lg7_x33zrgj00000gn/T/pip-wheel-sd9x1ng7
cwd: /private/var/folders/sc/gl1552412gb0lg7_x33zrgj00000gn/T/pip-install-l7tec_bv/lxml_b78f1cdebea441d2b840e6957fabe83a/
Building wheel for lxml (setup.py) ... error
ERROR: Failed building wheel for lxml
Running setup.py clean for lxml
Running command python setup.py clean
Building lxml version 4.9.2.
Building without Cython.
Building against libxml2 2.9.13 and libxslt 1.1.35
running clean
removing 'build/temp.macosx-10.9-universal2-cpython-310' (and everything under it)
removing 'build/lib.macosx-10.9-universal2-cpython-310' (and everything under it)
'build/bdist.macosx-10.9-universal2' does not exist -- can't clean it
'build/scripts-3.10' does not exist -- can't clean it
removing 'build'
...
× Running setup.py install for pycryptodomex did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /Users/gianlucatrentin/gptenv/bin/python3 -u -c '
exec(compile('"'"''"'"''"'"'
# This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
#
# - It imports setuptools before invoking setup.py, to enable projects that directly
# import from `distutils.core` to work with newer packaging standards.
# - It provides a clear error message when setuptools is not installed.
# - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
# setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
# manifest_maker: standard file '"'"'-c'"'"' not found".
# - It generates a shim setup.py, for handling setup.cfg-only projects.
import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute `setup.py` since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)
__file__ = %r
sys.argv[0] = __file__
if os.path.exists(__file__):
filename = __file__
with tokenize.open(__file__) as f:
setup_py_code = f.read()
else:
filename = "<auto-generated setuptools caller>"
setup_py_code = "from setuptools import setup; setup()"
exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'/private/var/folders/sc/gl1552412gb0lg7_x33zrgj00000gn/T/pip-install-l7tec_bv/pycryptodomex_7192f9e9e3b34b15b1960598d9d7eb02/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' install --record /private/var/folders/sc/gl1552412gb0lg7_x33zrgj00000gn/T/pip-record-n_aypwf1/install-record.txt --single-version-externally-managed --compile --install-headers /Users/gianlucatrentin/gptenv/include/site/python3.10/pycryptodomex
cwd: /private/var/folders/sc/gl1552412gb0lg7_x33zrgj00000gn/T/pip-install-l7tec_bv/pycryptodomex_7192f9e9e3b34b15b1960598d9d7eb02/
Running setup.py install for pycryptodomex ... error
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pycryptodomex
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I try to upgrade all the mentione libraries but couldn't make it work.
Do you have suggestions on how to solve this installing issue?

Related

Error pip installing wheel file from github repository (to download pycocotools)

I am installing Tensorflow (1.15.0) in order to perform some deep learning object detection, but am having trouble pip installing pycocotools. I am following this tutorial, which is an updated tutorial originally from YouTube channel Sentdex. I am also using the Anaconda Prompt for this purpose.
After creating and activating a conda environment and installing all the needed packages (TensorFlow, lxml, etc.), I am trying to run the command pip install pycocotools package, but get the following error:
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\anaconda3\envs\object\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\AppData\Local\Temp\pip-wheel-au01c73g'
cwd: C:\AppData\Local\Temp\pip-install-f_16w712\pycocotools\
Complete output (16 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.7\pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
C:\anaconda3\envs\object\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\AppData\Local\Temp\pip-install-f_16w712\pycocotools\pycocotools\_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pycocotools._mask' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Failed building wheel for pycocotools
Running setup.py clean for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
Running setup.py install for pycocotools ... error
ERROR: Command errored out with exit status 1:
command: 'C:\anaconda3\envs\object\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\AppData\Local\Temp\pip-record-bjfh6urg\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\anaconda3\envs\object\Include\pycocotools'
cwd: C:\AppData\Local\Temp\pip-install-f_16w712\pycocotools\
Complete output (14 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.7\pycocotools
running build_ext
skipping 'pycocotools\_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\anaconda3\envs\object\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\AppData\Local\Temp\pip-record-bjfh6urg\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\anaconda3\envs\object\Include\pycocotools' Check the logs for full command output.
Apparently, there is a wheel file that needs to be downloaded from this github repository, under the subdirectory PythonAPI. I ran this code to do so:
pip install git+https://github.com/philferriere/cocoapi#egg=pycocotools^subdirectory==PythonAPI
The following error is produced:
Collecting pycocotoolssubdirectory==PythonAPI
Cloning https://github.com/philferriere/cocoapi to c:\appdata\local\temp\pip-install-c_lq0qhi\pycocotoolssubdirectory
ERROR: Command errored out with exit status 1:
command: 'C:\anaconda3\envs\object\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\AppData\\Local\\Temp\\pip-install-c_lq0qhi\\pycocotoolssubdirectory\\setup.py'"'"'; __file__='"'"'C:\\AppData\\Local\\Temp\\pip-install-c_lq0qhi\\pycocotoolssubdirectory\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\AppData\Local\Temp\pip-pip-egg-info-0mcbi3nr'
cwd: C:\AppData\Local\Temp\pip-install-c_lq0qhi\pycocotoolssubdirectory\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\anaconda3\envs\object\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\AppData\\Local\\Temp\\pip-install-c_lq0qhi\\pycocotoolssubdirectory\\setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
How can I successfully install this repository? I need the wheel file so that I can proceed with the pycocotools installation. Note: I have installed the latest version of pip, so that isn't the issue.
Try running it as follows:
pip install pycocotools-windows
as suggested here.

Orange Error During Installing Text Add On

I am trying to install the Text add-on (version 0.7.3) for Orange (version 3.23) on my Win10, but I am getting the following error during the building "ufal_udpipe":
Command failed: python python -m pip install --constraint 'C:\Users\Jakub\AppData\Local\Temp\tmpb4fneogu.txt' Orange3-Text exited with non zero status.
ERROR: Command errored out with exit status 1: 'C:\Users\Jakub\AppData\Local\Orange\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Jakub\\AppData\\Local\\Temp\\pip-install-r71cit89\\ufal.udpipe\\setup.py'"'"'; __file__='"'"'C:\\Users\\Jakub\\AppData\\Local\\Temp\\pip-install-r71cit89\\ufal.udpipe\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Jakub\AppData\Local\Temp\pip-record-gtt8e801\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
I also tried to install Microsoft Visual C++, because it´s required in the log, but the problem is the same after the installation.
I tried to install add-on throught the Anaconda Prompt:
conda config --add channels conda-forge
conda install orange3-text
This process failed, because:
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while installing package 'conda-forge::commonmark-0.9.0-py_0'.
CondaError: Cannot link a source that does not exist. C:\Users\Jakub\Miniconda3\Scripts\conda.exe
Running `conda clean --packages` may resolve your problem.
Attempting to roll back.
Rolling back transaction: done
The result of conda clean command is following:
Traceback (most recent call last):
File "C:\Users\Jakub\Miniconda3\Scripts\conda-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\cli\main.py", line 112, in main
from ..exceptions import conda_exception_handler
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\exceptions.py", line 18, in <module>
from .common.io import timeout
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\common\io.py", line 28, in <module>
from .._vendor.tqdm import tqdm
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\_vendor\tqdm\__init__.py", line 8, in <module>
from ._tqdm import tqdm
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\_vendor\tqdm\_tqdm.py", line 13, in <module>
from ._utils import _supports_unicode, _environ_cols_wrapper, _range, _unich, \
File "C:\Users\Jakub\Miniconda3\lib\site-packages\conda\_vendor\tqdm\_utils.py", line 31, in <module>
colorama.init()
AttributeError: module 'colorama' has no attribute 'init'
Reinstall of Orange and Anaconda didn´t help.
Full extract of logs is here: Google Disk
Thank you for your help!
Jakub
I encountered just the first line of your error. I checked if I had python and anaconda installed properly or not (and I had). I then kept trying to install and in the 4th go it installed without an issue- now my guess is maybe network issues caused the error to occur.
Another thing suggested to me by their support was- "Yes, we are aware of the issue. Somewhere in the process we accidentally disabled the necessary setting. Go to Options - Settings, find the Add-ons tab and select 'Install add-ons with conda'. This should install Text successfully."
Okay, so I found the issue fix (at least for me - comment if it works for you).
How to fix it:
Download Colorama
Copy the "Colorama" from the download then replace the folder named "colorama" in C:\Program Files\Anaconda3\Lib\site-packages
I suspect this issue occurs because of (issue 8842)

Launching Tensorboard: bad interpreter: No such file or directory

I am unable to run tensorboard, and get the message:
bad interpreter: No such file or directory
Steps to reproduce:
Installed TF on Ubuntu, using a virtenv, and pip as per instructions install instructions
Confirmed TF was correctly installed by running the mnist example. Output was as expected
Attempted to run tensorboard using:
tensorboard --logdir=/tmp/tensorflow/mnist/logs/mnist_with_summaries/
Checked that this location does contain the summary files within the "test" and "train" directories
Command and error:
(tensorflow_1_4_0) js#pchome01:~$ tensorboard --logdir=/tmp/tensorflow/mnist/logs/mnist_with_summaries/
bash: /home/js/tensorflow_1_4_0/bin/tensorboard: /home/js/tensorflow_1_3/bin/python3: bad interpreter: No such file or directory
In my virtenv folder for tensorflow_1_4_0, a tensorboard script exists:
#!/home/js/tensorflow_1_3/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from tensorboard.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
When I run the following from the terminal, no errors are reported:
from tensorboard.main import main
Thank you
Just spotted my silly mistake and posting the resolution in case others encounter this.
The meaning of the error message is that the interpreter of the code (in this case python3) cannot be found.
The first line of the tensorboard script:
#!/home/js/tensorflow_1_3/bin/python3
This tells the compiler to look for python3 at this location, however this path is incorrect and the virtual environment is actually called tensorflow_1_4_0.
Therefore changing this line to the following fixed the error:
#!/home/js/tensorflow_1_4_0/bin/python3

Installing C SDK for couchbase, Mac OSX 10.6.8 -- How can I correct cmake errors?

I am trying to get couchbase up and running for python on Mac OSX 10.6.8. I'm following the instructions here:
http://docs.couchbase.com/couchbase-sdk-python-1.2/index.html#getting-started
But I'm stuck on step 2:
Download and install the C library.
According to the instructions for installing the C SDK here:
http://docs.couchbase.com/developer/c-2.4/download-install.html
I did this:
~$ brew update
....
....
~$ brew install libcouchbase
But I'm getting an error when homebrew tries to install the dependency cmake:
==> Installing libcouchbase dependency: cmake
==> Downloading http://www.cmake.org/files/v3.1/cmake-3.1.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake-3.1.0.tar.gz
==> Patching
==> Downloading https://pypi.python.org/packages/source/S/Sphinx/Sphinx-1.2.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--sphinx-1.2.3.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> Downloading https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--markupsafe-0.23.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> Downloading https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--docutils-0.12.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> Downloading https://pypi.python.org/packages/source/P/Pygments/Pygments-2.0.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--pygments-2.0.1.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> Downloading https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--jinja2-2.7.3.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> ./bootstrap --prefix=/Users/7stud/.homebrew/Cellar/cmake/3.1.0 --system-libs --parallel=2 --no-system-libarchiv
==> make
[ 34%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_write_set_options.c.o
[ 34%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/filter_fork_posix.c.o
Linking C static library libcmlibarchive.a
[ 34%] Built target cmlibarchive
make: *** [all] Error 2
READ THIS: http://git.io/brew-troubleshooting
These open issues may also help:
Fix LLVM CMake modules not being preprocessed (https://github.com/Homebrew/homebrew/pull/29976)
cmake builds fail on CLT-only with --env=std (https://github.com/Homebrew/homebrew/issues/29101)
More detail here:
~$ brew gist-logs --config --doctor cmake
https://gist.github.com/a37987f168d284128cfe
Anyone have any ideas on what I should do? Thanks.
Do you have the latest (available for 10.6.8) version of Xcode and its devtools? It appears to be an issue with GCC (I initially had issues with the LLVM gcc version Apple packages with Xcode).
Try brew install gcc (or brew reinstall gcc if you initially used brew to install gcc) and then run brew install make again.
I've got XCode version 3.2.6 installed, which I believe is the highest version compatible with OSX 10.6.8.
In the gist, whose link I posted, one of the errors is:
error: ncurses/ncurses.h: No such file or directory
I found ncurses.h on my system here:
/usr/include$ ls -al ncurses.h
lrwxr-xr-x 1 root wheel 8 Aug 11 2012 ncurses.h -> curses.h
...which if you note is not in a directory called ncurses(look at the prompt)--ncurses being the directory where the error message says ncurses.h should be. Also, note that ncurses.h is a link to another file: curses.h (see the arrow on the right?). So, I did this:
/usr/include$ sudo mkdir ncurses
Password:
/usr/include$ cd ncurses
/usr/include/ncurses$ sudo cp -av ../ncurses.h . (-a => copy link rather than the file it points to, -v => verbose, show what is being copied)
Password:
../ncurses.h -> ./ncurses.h
/usr/include/ncurses$ ls -al
total 8
drwxr-xr-x 3 root wheel 102 Dec 29 18:59 .
drwxr-xr-x 272 root wheel 9248 Dec 29 18:13 ..
lrwxr-xr-x 1 root wheel 8 Dec 29 18:59 ncurses.h -> curses.h
Then I tried installing libcouchbase again:
~$ brew install libcouchbase
==> Installing libcouchbase dependency: cmake
==> Downloading http://www.cmake.org/files/v3.1/cmake-3.1.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake-3.1.0.tar.gz
==> Patching
==> Downloading https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--jinja2-2.7.3.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> Downloading https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.ta
Already downloaded: /Library/Caches/Homebrew/cmake--markupsafe-0.23.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> Downloading https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--docutils-0.12.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> Downloading https://pypi.python.org/packages/source/P/Pygments/Pygments-2.0.1.tar.g
Already downloaded: /Library/Caches/Homebrew/cmake--pygments-2.0.1.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> Downloading https://pypi.python.org/packages/source/S/Sphinx/Sphinx-1.2.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--sphinx-1.2.3.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> ./bootstrap --prefix=/Users/7stud/.homebrew/Cellar/cmake/3.1.0 --system-libs --para
==> make
==> make install
/Users/7stud/.homebrew/Cellar/cmake/3.1.0: 1819 files, 33M, built in 18.5 minutes
==> Installing libcouchbase
==> Downloading http://packages.couchbase.com/clients/c/libcouchbase-2.4.5_1_gd7f6ecf.t
######################################################################## 100.0%
==> Patching
==> cmake .. -DCMAKE_INSTALL_PREFIX=/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_
==> make install
/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf: 53 files, 1.4M, built in 42 seconds
$
I didn't believe it, so I tried again:
~$ brew install libcouchbase
Warning: libcouchbase-2.4.5_1_gd7f6ecf already installed
~$ brew uninstall libcouchbase
Uninstalling /Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf...
~$ brew install libcouchbase
==> Downloading http://packages.couchbase.com/clients/c/libcouchbase-2.4.5_1_gd7f6ecf.t
Already downloaded: /Library/Caches/Homebrew/libcouchbase-2.4.5_1_gd7f6ecf.tar.gz
==> Patching
==> cmake .. -DCMAKE_INSTALL_PREFIX=/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_
==> make install
/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf: 53 files, 1.4M, built in 30 seconds
~$
Testing the install:
/usr/include/ncurses$ cbc version
cbc:
Runtime: Version=2.4.5_1_gd7f6ecf, Changeset=d7f6ecfa15e73c668a8f81947d9f85b654dcdbda
Headers: Version=2.4.5_1_gd7f6ecf, Changeset=d7f6ecfa15e73c668a8f81947d9f85b654dcdbda
IO: Default=libevent, Current=libevent
SSL: .. SUPPORTED
Python SDK
But then I was unable to install the Python SDK following the instructions here:
http://docs.couchbase.com/couchbase-sdk-python-1.2/
$ python -V
Python 2.7.9
I got to here:
5. Install the Python SDK. The easiest way to do this is via the pip tool:
shell> pip install couchbase --quiet
But this is what happened:
$ pip install couchbase --quiet
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
-c "import setuptools;file='/private/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip_build_7stud/couchbase/setup.py';exec(compile(open(file).read().replace('\r\n',
'\n'), file, 'exec'))" install --record
/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip-eflT9C-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip_build_7stud/couchbase
Traceback (most recent call last): File
"/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 9,
in
load_entry_point('pip==1.4.1', 'console_scripts', 'pip')() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/init.py",
line 148, in main
return command.main(args[1:], options) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/basecommand.py",
line 169, in main
text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 63: ordinal not in range(128)
Same thing here:
$ LC_ALL=C pip install couchbase --quiet
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
-c "import setuptools;file='/private/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip_build_7stud/couchbase/setup.py';exec(compile(open(file).read().replace('\r\n',
'\n'), file, 'exec'))" install --record
/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip-Oe6ydu-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip_build_7stud/couchbase
Storing complete log in /Users/7stud/.pip/pip.log
/usr/include/ncurses$ pip install couchbase --quiet Command
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
-c "import setuptools;file='/private/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip_build_7stud/couchbase/setup.py';exec(compile(open(file).read().replace('\r\n',
'\n'), file, 'exec'))" install --record
/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip-GijsbQ-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip_build_7stud/couchbase
Traceback (most recent call last): File
"/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 9,
in
load_entry_point('pip==1.4.1', 'console_scripts', 'pip')() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/init.py",
line 148, in main
return command.main(args[1:], options) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/basecommand.py",
line 169, in main
text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 63: ordinal not in range(128)
I fixed the unicode error by patching the python source code:
#text = '\n'.join(complete_log)
#python 2.x patch found here: https://github.com/pypa/pip/issues/1137
text = '\n'.join(to_utf8(l) for l in complete_log)
But then I got this error:
$ pip install couchbase --quiet
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
-c "import setuptools;file='/private/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip_build_7stud/couchbase/setup.py';exec(compile(open(file).read().replace('\r\n',
'\n'), file, 'exec'))" install --record
/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip-AQtdf2-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-/pip_build_7stud/couchbase
Storing complete log in /Users/7stud/.pip/pip.log
$
(I just looked at the error log mentioned above: pip.log, and it says the error was a KeyboardInterrupt. Huh? So, I tried $ pip install couchbase --quiet again and it worked. Then, to test the install $ python -c 'import couchbase', and there were no errors! I don't know if the stuff I did below influenced anything.)
Next, I decided to try installing from source:
According to the README file:
~/Downloads/couchbase-1.2.4$ python setup.py build_ext --inplace
But that ended like this:
src/exceptions.c:136: error: too many arguments to function
‘pycbc_exc_map’ lipo: can't figure out the architecture type of:
/var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI/-Tmp-//ccZekvJj.out error:
command 'gcc-4.2' failed with exit status 1
Next, I did this:
~/Downloads/couchbase-1.2.4$ python setup.py build_ext \
> --library-dir ~/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf/lib \
> --include-dir ~/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf/include
running build_ext building 'couchbase._libcouchbase' extension gcc-4.2
-fno-strict-aliasing -fno-common -dynamic -isysroot
...
...
intel-2.7/src/iops.o
build/temp.macosx-10.6-intel-2.7/src/connevents.o
build/temp.macosx-10.6-intel-2.7/src/pipeline.o
build/temp.macosx-10.6-intel-2.7/src/viewrow/viewrow.o
build/temp.macosx-10.6-intel-2.7/src/contrib/jsonsl/jsonsl.o
-L/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf/lib -lcouchbase -o build/lib.macosx-10.6-intel-2.7/couchbase/_libcouchbase.so
...which ended without error. But testing the install failed:
~/Downloads/couchbase-1.2.4$ python -c 'import couchbase'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "couchbase/__init__.py", line 18, in <module>
from couchbase.connection import Connection
File "couchbase/connection.py", line 22, in <module>
import couchbase._bootstrap
File "couchbase/_bootstrap.py", line 34, in <module>
import couchbase.exceptions as E
File "couchbase/exceptions.py", line 18, in <module>
import couchbase._libcouchbase as C
ImportError: No module named _libcouchbase
So, I thought what the heck, I'll go ahead and try this:
~/Downloads/couchbase-1.2.4$ python setup.py install
...
...
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/couchbase-1.2.4-py2.7-macosx-10.6-intel.egg
Processing dependencies for couchbase==1.2.4
Finished processing dependencies for couchbase==1.2.4
But, I got the same import error when testing the install, so I gave up.
After reading the answer to my question, I did:
$ brew install gcc
but I didn't try to fix couchbase until now. I don't think installing gcc with homebrew did anything because I still get:
~$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc.
build 5666) (dot 3) Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
/usr/bin$ which gcc
/usr/bin/gcc
/usr/bin$ ls -al /usr/bin/gcc
lrwxr-xr-x 1 root wheel 7 Aug 11 2012 /usr/bin/gcc -> gcc-4.2
...which is the Apple version of gcc. But, when I installed gcc with homebrew I got the output:
/Users/7stud/.homebrew/Cellar/gcc/4.9.2_1: 1155 files, 200M, built in
106.8 minutes
...which is gcc version 4.9.

Install MatPlotLib 1.2.x on OS X Lion 10.7.4 and Python 3.2.2

I asked a question a couple of days ago regarding installing numpy on the same system. Thankfully, I managed to solve that one myself but unfortunately I am now stuck trying to install matplotlib.
I first of all tried the current distributed version but had no luck with that so I thought i would download the git repository and try that. I have got this far:
changed the make.osx file so that it will work in Python 3:
import urllib -> import urllib.request
urllib.urlretrieve() -> urllib.request.urlretrieve()
Even after that I still had a problem with it not finding the freetype2 headers. I googled around and discovered that I could solve this by editing a line in setupext.py:
'darwin' : [], -> 'darwin' : ['/usr/local'],
However, I still get an error message when using the make.osx file. Here is how I am calling the file from Terminal:
sudo make -f make.osx PREFIX=/usr/local PYVERSION=3.2 fetch deps mpl_build mpl_install
I realise that matplotlib isn't officially supported on Python 3 yet but I thought that maybe someone somewhere as at least managed to get it to compile/install?
Any help would be much appreciated,
Adam.
I have included the error I get below:
basedirlist is: ['/usr/local']
============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.2.x
python: 3.2.2 (v3.2.2:137e45f15c0b, Sep 3 2011, 17:28:59)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
platform: darwin
REQUIRED DEPENDENCIES
numpy: 1.6.2rc1
freetype2: found, but unknown version (no pkg-config)
OPTIONAL BACKEND DEPENDENCIES
libpng: found, but unknown version (no pkg-config)
Tkinter: Tkinter: version not identified, Tk: 8.5, Tcl: 8.5
Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
Mac OS X native: yes
Qt: no
Qt4: Qt: 4.7.4, PyQt4: 4.8.6
PySide: no
Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: matplotlib will provide
pytz: matplotlib will provide
adding pytz
OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: /bin/sh: gs: command not found
latex: no
[Edit setup.cfg to suppress the above messages]
============================================================================
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']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.macosx-10.6-intel-3.2/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.macosx-10.6-intel-3.2/matplotlib/mpl-data
running build_ext
building 'matplotlib.ft2font' extension
gcc-4.2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -I/usr/local/include -I/usr/local/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include -I/usr/local/include -I. -I/usr/local/include/freetype2 -I/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/freetype2 -I/usr/local/include/freetype2 -I./freetype2 -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c src/ft2font.cpp -o build/temp.macosx-10.6-intel-3.2/src/ft2font.o
In file included from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/bytearrayobject.h:9,
from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:73,
from ./CXX/WrapPython.h:58,
from ./CXX/Extensions.hxx:37,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:45,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:70,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/char_traits.h:46,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/string:47,
from ./CXX/Python3/Exception.hxx:47,
from ./CXX/Python3/Objects.hxx:45,
from ./CXX/Python3/Extensions.hxx:52,
from ./CXX/Extensions.hxx:42,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h: In function ‘int std::__convert_from_v(int* const&, char*, int, const char*, ...)’:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h:77: error: ‘va_start’ was not declared in this scope
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h:85: error: ‘va_end’ was not declared in this scope
In file included from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/bytearrayobject.h:9,
from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:73,
from ./CXX/WrapPython.h:58,
from ./CXX/Extensions.hxx:37,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:45,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:70,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/char_traits.h:46,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/string:47,
from ./CXX/Python3/Exception.hxx:47,
from ./CXX/Python3/Objects.hxx:45,
from ./CXX/Python3/Extensions.hxx:52,
from ./CXX/Extensions.hxx:42,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h: In function ‘int std::__convert_from_v(int* const&, char*, int, const char*, ...)’:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h:77: error: ‘va_start’ was not declared in this scope
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h:85: error: ‘va_end’ was not declared in this scope
lipo: can't figure out the architecture type of: /var/tmp//ccafJH1l.out
error: command 'gcc-4.2' failed with exit status 1
make: *** [mpl_build] Error 1
Okay...I think have managed to get matplotlib to install now...
First of all you need to install numpy. I have instructions to do this on another post: install numpy
Now open Terminal and clone the git repository for matplotlib (assumes you have git installed):
git clone git://github.com/matplotlib/matplotlib.git (this might take a while)
Once the clone is complete open your user folder in Finder
In your user folder open the matplotlib directory
There is a file called `make.osx' open this with TextEdit (or similar)
Change the following lines:
MACOSX_DEPLOYMENT_TARGET=10.6
OSX_SDK_VER=10.6
To:
MACOSX_DEPLOYMENT_TARGET=10.7
OSX_SDK_VER=10.7
Change the following lines:
${PYTHON} -c 'import urllib; urllib.urlretrieve("${ZLIBURL}", "${ZLIBFILE}")' &&\
${PYTHON} -c 'import urllib; urllib.urlretrieve("${PNGURL}", "${PNGFILE}")' &&\
${PYTHON} -c 'import urllib; urllib.urlretrieve("${FREETYPEURL}", "${FREETYPEFILE}")'
To:
${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${ZLIBURL}", "${ZLIBFILE}")' &&\
${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${PNGURL}", "${PNGFILE}")' &&\
${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${FREETYPEURL}", "${FREETYPEFILE}")'
Save the changes
Open the file called setupext.py in idle
Find the line 'darwin' : [], and change it to 'darwin' : ['/usr/local'],
Save the file
Open Terminal again and type the following:
sudo make -f make.osx PREFIX=/usr/local PYVERSION=3.2 fetch deps mpl_build mpl_install
After some time matplotlib should be installed in the following directory:
/usr/local/lib/Python3.2/site-packages/
Open the above directory and also the following directory:
/Library/Python/3.2/site-packages/
Copy/move the following directories from /usr/local/lib/Python3.2/site-packages/ to /Library/Python/3.2/site-packages/:
dateutil
matplotlib
mpl_toolkits
matplotlib should be now installed
If you open idle and type import matplotlib it shouldn't return an error
I tried out the matplotlib/examples/user_interfaces/embedding_in_qt4_wtoolbar.py file and it seems works fine
Hope someone else finds this useful!
Thanks again for the assistance,
Adam.