When verifying my tensorflow installation as per the instructions here:
https://www.tensorflow.org/install/install_mac#ValidateYourInstallation
I get the following error message immediately after importing tf:
(tensorflow) Davids-iMac:~ david$ python
Python 3.6.1 (default, Apr 24 2017, 06:18:27)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
python(12966,0x7fffa84273c0) malloc: *** error for object 0x10b235eb0:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
I have had this problem on two different Macs; this installation was in a virtualenv, the other installation python directly. I installed python 3, readline and pip from scratch with Macports using sudo -H.
I also used sudo port select --set python python36 to set python3 to be the default (same for pip3).
Any hints where I went wrong greatly appreciated.
Here the virtualenv installation of tf:
cd /opt/local/bin
sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/virtualenv
cd
virtualenv --system-site-packages -p python3 tensorflow/
The path python3 (from --python=python3) does not exist
Davids-iMac:~ david$ virtualenv --system-site-packages -p python tensorflow/
Running virtualenv with interpreter /opt/local/bin/python
Using base prefix '/opt/local/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/david/tensorflow/bin/python
Installing setuptools, pip, wheel...done.
Davids-iMac:~ david$ source ~/tensorflow/bin/activate
(tensorflow) Davids-iMac:~ david$ pip -V
pip 9.0.1 from /Users/david/tensorflow/lib/python3.6/site-packages (python 3.6)
(tensorflow) Davids-iMac:~ david$ pip install --upgrade tensorflow
Collecting tensorflow
Downloading tensorflow-1.1.0-cp36-cp36m-macosx_10_11_x86_64.whl (31.3MB)
100% |████████████████████████████████| 31.3MB 49kB/s
Collecting numpy>=1.11.0 (from tensorflow)
Downloading numpy-1.12.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.4MB)
100% |████████████████████████████████| 4.4MB 319kB/s
Requirement already up-to-date: wheel>=0.26 in ./tensorflow/lib/python3.6/site-packages (from tensorflow)
Collecting werkzeug>=0.11.10 (from tensorflow)
Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
100% |████████████████████████████████| 317kB 3.0MB/s
Collecting six>=1.10.0 (from tensorflow)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting protobuf>=3.2.0 (from tensorflow)
Downloading protobuf-3.3.0.tar.gz (271kB)
100% |████████████████████████████████| 276kB 3.2MB/s
Requirement already up-to-date: setuptools in ./tensorflow/lib/python3.6/site-packages (from protobuf>=3.2.0->tensorflow)
Building wheels for collected packages: protobuf
Running setup.py bdist_wheel for protobuf ... done
Stored in directory: /Users/david/Library/Caches/pip/wheels/1b/42/a0/4c7343df5b629ec9c75655468dce7652b28026896b0209ba55
Successfully built protobuf
Installing collected packages: numpy, werkzeug, six, protobuf, tensorflow
Successfully installed numpy-1.12.1 protobuf-3.3.0 six-1.10.0 tensorflow-1.1.0 werkzeug-0.12.2
(tensorflow) Davids-iMac:~ david$ python
Python 3.6.1 (default, Apr 24 2017, 06:18:27)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
python(12966,0x7fffa84273c0) malloc: *** error for object 0x10b235eb0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Related
In virtual environment I'm trying to install apache-airflow.
macOS: 10.13.6
Python: 3.9
(airflow_venv) $ sudo -H pip install apache-airflow==1.10.12 --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-1.10.12/constraints-3.7.txt
after installing quite some other wheels, for pandas I get the following error -
ERROR: Could not build wheels for pandas which use PEP 517 and cannot be installed directly
I've tried updating wheel and pip.
change to python3.8, python3.9 has some compatibility issues
How do you go about installing OpenVino using Anaconda. Will this be possible with prerequisites like OpenCV and CMake that are required for installation.
(IntelEnv) ChrNinja#ChrNinja demo % ./demo_squeezenet_download_convert_run.sh
target_precision = FP16
[setupvars.sh] OpenVINO environment initialized
###################################################
Downloading the Caffe model and the prototxt
Installing dependencies
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing /Users/christianh/Library/Caches/pip/wheels/a7/c1/ea/cf5bd31012e735dc1dfea3131a2d5eae7978b251083d6247bd/PyYAML-5.3.1-cp27-cp27m-macosx_10_15_x86_64.whl
Collecting requests
Using cached https://files.pythonhosted.org/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl
Collecting idna<3,>=2.5
Using cached https://files.pythonhosted.org/packages/89/e3/afebe61c546d18fb1709a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl
Collecting chardet<4,>=3.0.2
Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17
Using cached https://files.pythonhosted.org/packages/57/2b/26e37a4b034800c960a00c4e1b3d9ca5d7014e983e6e729e33ea2f36426c/certifi-2020.4.5.1-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
Using cached https://files.pythonhosted.org/packages/e1/e5/df302e8017440f111c11cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl
Installing collected packages: pyyaml, idna, chardet, certifi, urllib3, requests
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/PyYAML-5.3.1.dist-info'
Consider using the `--user` option or check the permissions.
Error on or near line 150; exiting with status 1
1. Update conda to latest version:
conda update --all
2. Install the Intel® Distribution of OpenVINO™ Toolkit:
conda install openvino-ie4py -c openvino
3. Install OpenCV. This is required to run a sample:
conda install opencv
4. Verify the package installed:
python -c “import openvino”
Pip is not installing the module for python correctly
I have upgraded python to 3.7.3 and creted a symbolic link to the new version. I am trying o import the module - requests, but it fails and gives a error. I suspect my links are incorrect.
which python
/usr/bin/python
# ls -lrt /usr/bin/python
lrwxrwxrwx 1 root root 28 May 22 12:36 /usr/bin/python -> /usr/bin/Python-3.7.3/python
which pip
/usr/local/bin/pip
which pip3
/usr/local/bin/pip3
# python -m pip install --user requests
/usr/bin/python: No module named pip
# python -m pip3 install --user requests
/usr/bin/python: No module named pip3
# pip3 install requests
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: requests in /root/.local/lib/python2.7/site-packages (2.20.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /root/.local/lib/python2.7/site-packages (from requests) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests) (2019.3.9)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/lib/python2.7/dist-packages (from requests) (1.24.1)
Requirement already satisfied: idna<2.8,>=2.5 in /root/.local/lib/python2.7/site-packages (from requests) (2.7)
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
# python
Python 3.7.3 (default, May 22 2019, 12:25:12)
[GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'
>>>
I am expecting use the module in the Linux terminal.. Works fine on Windows - cmd. Any advice appericted.
I resolved the ENV path variables to get around this issues
Good link is - https://stackabuse.com/how-to-permanently-set-path-in-linux/
Getting the following error on my Mac Terminal window.
$ pip --version
pip 6.1.1 from /Library/Python/2.7/site-packages (python 2.7)
Python version is 2.7.10
While trying to install credstash using brew, I'm getting the following error.
$ `which python` --version && brew update && brew install credstash
Python 2.7.10
Already up-to-date.
Error: No available formula with the name "credstash"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
Got the similar error, when I tried to install pip3 using brew.
Tried installing credstash from pip but that errored out as well.
[arun#MacBook-Pro-2 ~/aks/wspace] $ pip install credstash
You are using pip version 6.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting credstash
Using cached credstash-1.12.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.6.1 in /Library/Python/2.7/site-packages (from credstash)
Collecting boto3>=1.1.1 (from credstash)
Using cached boto3-1.4.2-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): jmespath<1.0.0,>=0.7.1 in /Library/Python/2.7/site-packages (from boto3>=1.1.1->credstash)
Collecting botocore<1.5.0,>=1.4.1 (from boto3>=1.1.1->credstash)
Using cached botocore-1.4.87-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.0 (from boto3>=1.1.1->credstash)
Using cached s3transfer-0.1.10-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached docutils-0.13.1-py2-none-any.whl
Collecting futures<4.0.0,>=2.2.0 (from s3transfer<0.2.0,>=0.1.0->boto3>=1.1.1->credstash)
Using cached futures-3.0.5-py2-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, docutils, botocore, futures, s3transfer, boto3, credstash
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 246, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 352, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 687, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 730, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 126, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 292, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/z5/37m4q63j3bn48y3dxgf40tdm0000gn/T/pip-LMRqSS-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
IF I don't use sudo in the above command, then I get the following exception error:
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/concurrent'
To get latest pip, as pip is provided via python on macOS, if I try to install python using brew, I'm getting the following, poking into it how I can remove Xcode first:
$ brew install python
Error: Your Xcode (5.0.2) is too outdated.
Please update to Xcode 8.2 (or delete it).
Xcode can be updated from the App Store.
$ pip --version
pip 6.1.1 from /Library/Python/2.7/site-packages (python 2.7)
As I thought I have an older pip version, I download this file:
$ wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py
Which successfully installed a newer version of pip. Now showing:
$ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
Retried doing pip install credstash but still getting the same error (with or without sudo).
I tried the following to get credstash installed.
Downloaded Python3 Mac binary from here.
https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg
Installed the .pkg file GUI way.
Opened a Terminal window in Mac.
[arun#MacBook-Pro-2 /tmp] $ which pip
/usr/local/bin/pip
[arun#MacBook-Pro-2 /tmp] $ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
[arun#MacBook-Pro-2 /tmp] $ which python
/usr/bin/python
[arun#MacBook-Pro-2 /tmp] $ python --version
Python 2.7.10
[arun#MacBook-Pro-2 /tmp] $ which python3
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
[arun#MacBook-Pro-2 /tmp] $ python3 --version
Python 3.5.2
[arun#MacBook-Pro-2 /tmp] $ which pip3
/Library/Frameworks/Python.framework/Versions/3.5/bin/pip3
[arun#MacBook-Pro-2 /tmp] $ pip3 --version
pip 8.1.1 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)
[arun#MacBook-Pro-2 /tmp] $
[arun#MacBook-Pro-2 /tmp] $ pip3 install credstash
Collecting credstash
Using cached credstash-1.12.0.tar.gz
Collecting pycrypto>=2.6.1 (from credstash)
Using cached pycrypto-2.6.1.tar.gz
Collecting boto3>=1.1.1 (from credstash)
Using cached boto3-1.4.2-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.0 (from boto3>=1.1.1->credstash)
Using cached s3transfer-0.1.10-py2.py3-none-any.whl
Collecting botocore<1.5.0,>=1.4.1 (from boto3>=1.1.1->credstash)
Using cached botocore-1.4.87-py2.py3-none-any.whl
Collecting jmespath<1.0.0,>=0.7.1 (from boto3>=1.1.1->credstash)
Using cached jmespath-0.9.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Downloading docutils-0.13.1-py3-none-any.whl (536kB)
100% |████████████████████████████████| 542kB 1.3MB/s
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: pycrypto, docutils, six, python-dateutil, jmespath, botocore, s3transfer, boto3, credstash
Running setup.py install for pycrypto ... done
Running setup.py install for credstash ... done
Successfully installed boto3-1.4.2 botocore-1.4.87 credstash-1.12.0 docutils-0.13.1 jmespath-0.9.0 pycrypto-2.6.1 python-dateutil-2.6.0 s3transfer-0.1.10 six-1.10.0
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[arun#MacBook-Pro-2 /tmp] $
[arun#MacBook-Pro-2 /tmp] $ which credstash
/Library/Frameworks/Python.framework/Versions/3.5/bin/credstash
[arun#MacBook-Pro-2 /tmp] $
If you're trying to install to system Python then you need sudo. If you want to just play around, look into creating a virtualenv and install there. http://docs.python-guide.org/en/latest/dev/virtualenvs/
I have python 2(as default) and 3 on my Linux machine. I created a virtual environment to try out pandas with python3. So, I ran:
virtualenv -p python3 pandas_env
If I type python inside of this env it goes to the standard python shell, with python 3 as the default version
(panda_env)$ python
Python 3.4.3 (default, Sep 14 2016, 12:36:27)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
To install ipython, I did:
(panda_env)$ pip install ipython
now, running ipython, it defaults to python2 instead of 3
(panda_env)$ ipython
WARNING: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
Type "copyright", "credits" or "license" for more information.
IPython 2.3.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
With a WARNING saying to install ipython inside virtualenv. I thought did installed ipython inside the environment, and why is it using python2.x by default?
How do I install ipython inside virtualenv correctly, and how can I make ipython use 3.x instead of 2.x?
Also, should I use pip or pip3 to install packages inside a virtualenv?
Note, for python > 3.3 it's recommended you start a virtual environment with the pyvenv command. This has now been deprecated as of python > 3.6 in favor of python3 -m venv <environment name> (via https://docs.python.org/3/library/venv.html)
In answer to your question, I don't believe it matters based on this check:
# start enviroment
$ python3 -m venv test_env; source test_env/bin/activate
# check python version
(test_env) $ python --version
Python 3.6.0
# check pip and pip3
(test_env) $ which pip
~/Documents/test_env/bin/pip
(test_env) $ which pip3
~/Documents/test_env/bin/pip3
# The pip commands are different, but if we check their versions they are the same and both appear to be using python3.
(test_env) $ pip -V
pip 9.0.1 from ~/test_env/lib/python3.6/site-packages (python 3.6)
(test_env) $ pip3 -V
pip 9.0.1 from ~/test_env/lib/python3.6/site-packages (python 3.6)
# In fact the binaries for pip and pip3 within the environment are identical as you can see with this.
(test_env) $ diff ~/Documents/test_env/bin/pip ~/Documents/test_env/bin/pip3
# Checking with ipython
(test_env) $ pip install ipython
(test_env) $ ipython
Python 3.6.0 (default, Dec 24 2016, 08:01:42)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
The easiest way to work with virtual environments is to download anaconda and use the conda version control system:
Works exactly the same way for all versions of python
Python is treated as just another package as part of the environment
Everything related to an environment is stored in one folder
You can see revision history and rollback to previous versions of the environment if something stops working