I'm having an issue with pip when pip install cannot download packages due to a no space error. While I investigate that, I'm trying to setup a work around by downloading the packages to a set folder, and then doing an offline installation, using:
pip download --no-cache-dir tensorflow -b /home/profile1/tmp/
In my research, I found that pip uses the root /tmp folder by default, and that it clears it after a successful installation. So, I set it to go to a different /tmp folder under the /profile1 directory. The command seems to work fine, but when I look at the directory it is empty. I've ruled out that the packages do not download by running it again, this time opening a new terminal. I navigated to /profile1/tmp and used ls while tensorflow downloaded. The package and its dependency packages downloaded - however, they dissappeared once the download was complete (used ls -ltra to confirm). I believe they are being moved, because when I used df -h /home, there was an increase in the space used. I need to be able to keep them in the /tmp folder, for installation. Any help would be greatly appreciated.
EDIT:
I tried using #sinoroc answer, and while it worked for the download, it still crashes with a no space error:
pip download --no-cache-dir tensorflow -d /home/profile1/tmp/
#downloads several packages
Traceback (most recent call last):
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/commands/download.py", line 135, in run
resolver.resolve(requirement_set)
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 482, in prepare_linked_requirement
hashes=hashes,
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 287, in unpack_url
hashes=hashes,
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 164, in unpack_http_url
unpack_file(from_path, location, content_type)
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/utils/unpacking.py", line 252, in unpack_file
flatten=not filename.endswith('.whl')
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/utils/unpacking.py", line 139, in unzip_file
shutil.copyfileobj(fp, destfp)
File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/shutil.py", line 82, in copyfileobj
fdst.write(buf)
OSError: [Errno 28] No space left on device
On using `df -h /home', I see that I have 20 GB left in the file system. Is there anything else I can do as far as remediation goes?
EDIT 2:
I was able to confirm that this is only with pip; I was able to use conda install to get tensorflow, but not pip.
Looks like you are looking for the --dest <dir> option.
$ pip download --help
[...]
-d, --dest <dir> Download packages into <dir>.
https://pip.pypa.io/en/stable/reference/pip_download/#cmdoption-d
Related
While using PyInstaller (dev version 4.0.dev0+8196c57ab), produced an OSError: [WinError 2] 'The system cannot find the file specified.'
Python version: 3.7
GUI: PySide2 5.13.0
Other packages: lxml, BeautifulSoup, Matplotlib (with dependencies like numpy), Pandas, pypiwin32, reportlab, Theano
Anaconda 3, Windows
Compiled with PyInstaller --onedir
What I've tried:
Tried downgrading PyInstaller to 2.1 as suggested here: https://github.com/pyinstaller/pyinstaller/issues/3916 but doesn't work as Python 3 is not supported
Was originally on PyInstaller 3.5, upgraded to dev version as suggested under some of the issues on PyInstaller github
Tried including --exclude-module=.git
import PyInstaller.__main__
if __name__ == '__main__':
PyInstaller.__main__.run([
'--name=%s' % 'Dummy App',
'--onedir',
'--nowindowed',
r'--workpath=C:\Users\User1\Desktop\build7',
r'--distpath=C:\Users\User1\Desktop\dist7',
'--hidden-import=theano.tensor.shared_randomstreams',
'--hidden-import=pandas._libs.tslibs.timedeltas',
'--clean',
'--add-data={0};.'.format('redacted.xml'),
'--add-data={0};{0}'.format('redacted_folder'),
'--add-data={0};.'.format('redacted.pdf'),
'--exclude-module={0}'.format('.git'),
'--log-level=WARN',
'MainWindow.py'
])
Full stacktrace:
79702 DEBUG: Analyzing .git\objects\78\e83411cea88cd038acb12c005a984fc0d6d423
Traceback (most recent call last):
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
yield
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags)
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\win32ctypes\core\ctypes\_util.py", line 42, in check_null
raise make_error(function, function_name)
OSError: [WinError 2] The system cannot find the file specified.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/User1/Dropbox/GitHub_Repos/DiabetesReportGenerator_v2/pyinstaller_freeze.py", line 37, in <module>
'MainWindow.py'
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\__main__.py", line 112, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\building\build_main.py", line 732, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\building\build_main.py", line 679, in build
exec(code, spec_namespace)
File "C:\Users\User1\Dropbox\GitHub_Repos\DiabetesReportGenerator_v2\Risk Calculator.spec", line 17, in <module>
noarchive=False)
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
self.__postinit__()
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\building\build_main.py", line 468, in assemble
redirects=self.binding_redirects))
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\depend\bindepend.py", line 226, in Dependencies
for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\depend\bindepend.py", line 402, in getAssemblyFiles
for assembly in getAssemblies(pth):
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\depend\bindepend.py", line 353, in getAssemblies
res = GetManifestResources(pth)
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1005, in GetManifestResources
return winresource.GetResources(filename, [RT_MANIFEST], names, languages)
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 168, in GetResources
hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags)
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Users\User1\Anaconda3\envs\ids_gui\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (2, 'LoadLibraryExW', 'The system cannot find the file specified.')
P.S. Compilation and the exe functioned perfectly with virtualenv environment created from Anaconda environment earlier (without need for --exclude-module=.git), but was too bloated with packages because the virtualenv environment is still considered to be part of the conda environment. So I used a new conda environment, and this error appeared
I've gotten it to work by creating another virtualenv environment in this new conda environment, but that is a very roundabout way. Is there any workaround?
For me, PyInstaller seems to search through .git folder and redacted_folder unnecessarily
I solved this problem by:
MOVING the folder(s) out of the directory before freezing
Additionally, if the folder is required for the frozen app to run (e.g. as a data folder), I would also either:
Comment / remove the corresponding part for --add-data and manually copy the folder over, or
Change the path for --add-data e.g. if you moved redacted_folder to your Desktop, you can change to '--add-data=C:/Users/User1/Desktop/redacted_folder'
You'll still need .git and redacted_folder back in the original directory to use Git and run your code without freezing
For example, I had trouble with .git and redacted_folder. The frozen executable needed redacted_folder to run parts of the code.
What I did was:
Move .git and redacted_folder to a separate directory
Then, I commented out the line to add data for redacted_folder:
import PyInstaller.__main__
if __name__ == '__main__':
PyInstaller.__main__.run([
'--name=%s' % 'Dummy App',
'--onedir',
'--nowindowed',
r'--workpath=C:\Users\User1\Desktop\build7',
r'--distpath=C:\Users\User1\Desktop\dist7',
'--hidden-import=theano.tensor.shared_randomstreams',
'--hidden-import=pandas._libs.tslibs.timedeltas',
'--clean',
'--add-data={0};.'.format('redacted.xml'),
# Remove `redacted_folder` and comment out the following line
# '--add-data={0};{0}'.format('redacted_folder'),
'--add-data={0};.'.format('redacted.pdf'),
'--exclude-module={0}'.format('.git'),
'--log-level=WARN',
'MainWindow.py'
])
After freezing, I copied redacted_folder over to the appropriate location relative to the frozen executable in distpath
This was fixed. Update PyInstaller.
I installed pyinstaller in a new conda environment using pip, however pywin32 did not get installed by default (eventhough documentation mentioned it would). Installing it fixed the error for me.
I had this same issue and found another thread where somebody uninstalled Python and then reinstalled Python to fix it.
The key information to understand the problem though, was that they had originally installed Python using Microsoft Store. When they reinstalled Python, they just downloaded Python from python.org and this took care of the problem. It worked for me too.
It seems very likely that something in the Microsoft Store version is causing problems like this.
Start from administrator cmd or ide and try again, it's helped me.
Running from Jupyter Notebook with elevated privilegies worked for me!
I receive an error when trying to import zmq:
Traceback (most recent call last): File "BasicPub.py", line 1, in <module>
import zmq File "/home/przemek/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/zmq/__init__.py", line 66, in <module>
from zmq import backend File "/home/przemek/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/zmq/backend/__init__.py", line 40, in <module>
reraise(*exc_info) File "/home/przemek/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/zmq/backend/__init__.py", line 27, in <module>
_ns = select_backend(first) File "/home/przemek/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/zmq/backend/select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api) File "/home/przemek/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/zmq/backend/cython/__init__.py", line 6, in <module>
from . import (constants, error, message, context, ImportError: /home/przemek/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/zmq/backend/cython/message.so: undefined symbol: zmq_msg_gets
Someone has suggested that I should completely remove zmq and reinstall it.
I have tried to do it with pip but it seems that in some config files remain. I have used locate and I manually removed some directories. I thought that it would help but after reinstallation still I have an error. I am using Python2.7 and Ubuntu 14.04.
You can try the following:
sudo rm /usr/local/lib/libzmq*
sudo rm /usr/local/include/zmq.h
Since these are the two locations that ZeroMQ's libzmq installs into.
This link provides a few options on how to uninstall zeromq if you use a Debian operating system.
You would need to use the purge command:
sudo apt-get purge --auto-remove python-zmq
You probably installed it using the source ditribution.
To undo this, cd to the build directory and type:
make uninstall
I used to install python (2.7.6) packages using sudo pip install [...] until I recently decided that this was a bad idea and I should use: pip install --user [...] instead.
Since I am using Mac OS X (10.10.3), my python modules had been installed into /Library/Python/2.7/site-packages. Now, with the --user option enabled, they are being installed into: /Users/USER/Library/Python/2.7/lib/python/site-packages
I have since moved all packages (including pip/setuptools) into this destination, adjusted my $PYTHONPATH and changed the file ownership to my local user. I expected that I would now be able to call pip install --user [..] and everything should go smoothly.
Unfortunately, this is not the case. For any pip install (or pip install --upgrade) command I receive the same error (below). The same is true when using a virtualenv - the same error shows up and I have no clue why.
However, everything does work "fine", when I use sudo pip install --user, which is why I assume that it is somehow related to a file-permission error I can not see. (It's not exactly fine, as the newly installed package will be in the right location, but all files are owned by root.)
Any idea what I am doing wrong or how to debug this?
pip install --upgrade --user tornado
Collecting tornado
Using cached tornado-4.1.tar.gz
Exception:
Traceback (most recent call last):
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/commands/install.py", line 280, in run
requirement_set.prepare_files(finder)
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 317, in prepare_files
functools.partial(self._prepare_file, finder))
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 304, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 483, in _prepare_file
abstract_dist.prep_for_dist()
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 123, in prep_for_dist
self.req_to_install.run_egg_info()
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py", line 368, in run_egg_info
self.setup_py, self.name,
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py", line 339, in setup_py
import setuptools # noqa
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extension import Extension
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/setuptools/extension.py", line 8, in <module>
from .dist import _get_unpatched
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/setuptools/dist.py", line 21, in <module>
packaging = pkg_resources.packaging
AttributeError: 'module' object has no attribute 'packaging'
I also checked the location of pkg_resources and deleted pkg_resources.pyc, which is located in /usr/local/lib/python2.7/site-packages for some reason, but it didn't change anything. (My local user also has full access rights in this location.)
[UPDATE:]
For some reason I was able to install virtualenv without root (pip install --user virtualenv), but all other packages I tried still fail. Also, if I switch to a new virtual environment, I still receive the same error. I am now thinking this is related to my $PYTHONPATH variable, which appears to not be updated for my virtualenv, but I haven't found the real solution, yet.
Alright, so I found the actual problem and solution. My $PYTHONPATH contained an invalid directory. I setup my $PYTHONPATH a long time ago and wrote it into a .bashrc (or more accurately .bash_profile) script.
pip was probably looking through all directories in $PYTHONPATH, although I don't know what it is doing in each of them that causes the above error, but removing the invalid directory fixed my problems.
I also now highly recommend to just use virtualenv instead of a static setup.
I'm trying to use cx_freeze 4.3.3 on a MacOS running 10.9.2 on a very simple PyQt5 script with Python 3.3.
No errors are returned and the .app is output. However when running the .app from terminal I obtain the error:
LSOpenURLsWithRole() failed with error -10810
which according to Apple's documentation is "Unknown Error".
The very simple code I try to run (PyQt5app.py) is:
import sys
from PyQt5.QtWidgets import QApplication, QDialog
app = QApplication(sys.argv)
form = QDialog()
form.show()
app.exec_()
The file setup.py is:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
options = {
'build_exe': {
'excludes': ['Tkinter'] # Sometimes a little finetuning is needed
}
}
executables = [
Executable('PyQt5app.py', base=base)
]
setup(name='PyQt5app',
version='0.1',
description='Sample PyQt5 GUI',
executables=executables,
options=options
)
and when running I call:
sudo python cx_freeze bdist_mac
obtaining this log : http://pastebin.com/VBxyyBRn
with app returning error above.
So, reading around I see it might be a problem related to including qt files in the app (or at least this was the issue on PyQt4) so I try specifying the qt-menu-nib directory:
sudo python setup.py bdist_mac --qt-menu-nib=/Users/franco/Qt5.2.1/5.2.1/clang_64/plugins/platforms/
obtaining this log: http://pastebin.com/TpRdrSmT
and the same not working error.
If I run the app from PyQt5app.app/Contents/MacOS/PyQt5app I get a lot of bootstrap errors:
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/cx_Freeze-4.3.3-py3.3-macosx-10.9-x86_64.egg/cx_Freeze/initscripts/Console.py", line 27, in <module>
exec(code, m.__dict__)
File "PyQt5app.py", line 5, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1565, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1532, in _find_and_load_unlocked
loader.load_module(name)
File "ExtensionLoader_PyQt5_QtWidgets.py", line 22, in <module>
File "ExtensionLoader_PyQt5_QtWidgets.py", line 14, in __bootstrap__
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1565, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1532, in _find_and_load_unlocked
loader.load_module(name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 584, in _check_name_wrapper
return method(self, name, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 495, in set_package_wrapper
module = fxn(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 508, in set_loader_wrapper
module = fxn(self, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1132, in load_module
fullname, self.path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 313, in _call_with_frames_removed
return f(*args, **kwds)
SystemError: initialization of sip raised unreported exception
Needless to say the script works fine when launching from terminal:
python PyQt5app.py
I most certainly am doing something wrong, so please, can anybody help me?
So, after long fighting here is the issue: libzmq .
I installed libzmq and specified the --qt-menu-nib option and the simple example above runs in both:
sudo python setup.py build
and
sudo python setup.py bdist_mac
Step by step instructions:
I used mac ports for most of my python33 packages so I sticked to it for the rest.
Libzmq is not available on macports but its dependencies are.
So:
1) install libtool, autoconf, automake:
sudo port install libtool
sudo port install autoconf
sudo port install automake
2) grab the latest version of libzmq from https://github.com/zeromq/libzmq ( I downloaded the ZIP for sake of order ) and unzip/navigate to the folder
/libzmq-master
now the instructions provided in the INSTALL document in the folder are pretty clear, if you installed all the dependencies then you will be fine.
run:
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
3) download the latest cx_freeze from https://bitbucket.org/anthony_tuininga/cx_freeze/downloads then unzip/untar navigate to folder and run:
sudo python setup.py build
sudo python setup.py install
now when compiling code for MacOSX that uses Python3.3 and PyQt5 you can run:
sudo python setup.py build
then navigate in the build folder and run the program as:
./nameoftheprogram
once you made sure this work then build the app or dmg (as you prefer) with:
sudo python setup.py bdist_mac --qt-menu-nib=/Users/username/Qt5.2.1/5.2.1/clang_64/plugins/platforms/
where the path is the path to your Qt5 installation. If I don't use the --qt-menu-nib option the app crashes on startup whereas the build works fine.
Hope this will help someone in the future.
I got the same error and recompiling with the latest version of ZMQ (4.0.4) did not solve the issue.
However, by looking in the messages of the /Applications/Utilities/Console.app program, I could see that an extra command line option was given to my Python program. This command line option always started with -psn_0_ followed by a number. Apparently psn stands for Process Serial Number (see: http://hintsforums.macworld.com/showthread.php?t=11978).
My program uses the argparse package to parse the command line arguments and exited with an error because it didn't recognized the -psn option. I now filter it out before parsing with argparse and this solved my problem.
Hello I am trying to install python-twitter and one of the dependencies HTTPLIB2 is giving me a lot of problems. I have searched the internet up and down but maybe I do not know what the right key words are. Here is the problem.
I am installing python-twitter. I install the requirements either by "pip install -r requirements.txt" or doing them one by one through for example "pip install httplib2". Then I run "python setup.py install". It's happy but then "python setup.py test" fails as followed with an error on import HTTPLIB2.
python setup.py test
running test
running egg_info
writing requirements to python_twitter.egg-info/requires.txt
writing python_twitter.egg-info/PKG-INFO
writing top-level names to python_twitter.egg-info/top_level.txt
writing dependency_links to python_twitter.egg-info/dependency_links.txt
reading manifest file 'python_twitter.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching '.DS_Store'
writing manifest file 'python_twitter.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 73, in <module>
Main()
File "setup.py", line 66, in Main
setuptools.setup(**METADATA)
File
....
<deleted these parts to save space>
module = __import__('.'.join(parts_copy))
File "/Users/ME/Downloads/python-twitter-1.0/twitter_test.py", line 30, in <module>
import twitter
File "/Users/ME/Downloads/python-twitter-1.0/twitter.py", line 65, in <module>
import oauth2 as oauth
File "/usr/local/lib/python2.7/site-packages/oauth2/__init__.py", line 32, in <module>
import httplib2
File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 347
print('%s:' % h, end=' ', file=self._fp)
^
SyntaxError: invalid syntax
But I thought the print error was an incompatibility between python 2 and 3. Why am I getting this while I clearly have python 2.7 (I checked and uninstalled and reinstalled HTTPLIB2).
Thanks much for your help
i had a same issue. It seems to be python2.7 and 3.x version conflict issue and resolved by
python2.7 -m pip install -t lib/ -r requirements.txt
Just in case, this happens when you install httplib2 with a python3 version of pip and then execute it with python2.
This happens for example when creating manually an environment with:
pip install -t lib/ -r requirements
As it happens when creating an AppEngine standard environment vendor folder.
This happens because contrary to most of the libraries, httplib2 has completely different versions for python2 and python3.