"inconsistent use of tabs and spaces in indentation" from easy_install - python

I have had a strange error today when I tried to upgrade some of my python apps (aka pip and aws clt) and received the following error:
File "/usr/bin/easy_install", line 31
continue
^
TabError: inconsistent use of tabs and spaces in indentation
Then I tried running easy_install --version and received the same error. I have all three of my computers (Macbook Pro, iMac, and Mac Pro) running the same commands, only my Macbook Pro has this error (and all of them share the identical python version and apps). I like to know what might be the cause of this error message.
P.S. I have tried to copy the "/usr/bin/easy_install" file from one computer to another and received the same error message.

This is really just my guessing. I have signed up for Apple Developer programer and used a beta test version of OS X. I then turned off the developer mode and returned to the ordinary Yosemite but the funny part is I cannot use easy_install afterward. I think turning off the developer mode is the same as turning off easy_install. I am not entirely sure if that is true but you can give it a try. Either reinstall the OS X, or simply turn the developer mode back on.

I am not really an expert on this so please consider this with caution ;)
I also run into this error recently and I think it is due to having multiple versions of easy_install and(!) multiple versions of python available.
in my case I have the following versions available:
easy_install
easy_install-2.6
easy_install-2.7
easy_install-3.4
after running
sudo easy_install-2.7 pip
I was able to (re)-install pip.
notes:
easy_install launches #!/usr/bin/python
in my case /usr/bin/python is a symlink to version 3.4 of python
easy_install is probably written for python 2.x and fails with error "inconsistent use of tabs and spaces in indentation" when using python 3.x

i I suggest you to upload the code.
it look like you don't use the correct tabulation
something like that:
for i in range(0,5):
print i
print i**2

Related

How to fix SublimeText 3 Python build error?

I use a Mac and haven't used Sublime Text and Python in a few months, and have come back to it for a project. But, I get an error when I try to build documents I've definitely built before, and even the simplest test document (ex. print("Hello World!")). It must be because of some Mac update, but I am not on Big Sur, I'm still on Catalina. I can't update to Big Sur to fix my problem because of my work I need certain programs that are not compatible with Big Sur yet.
I get the following error:
/Users/maxzhou/.bash_profile: line 1: export: `v6.1.1/bin': not a valid identifier
bash: /Library/Frameworks/Python.framework/Versions/2.7/bin/python: Bad CPU type in executable
[Finished in 0.0s with exit code 126]
[shell_cmd: python -u "/Users/maxzhou/Documents/Test file.py"]
[dir: /Users/maxzhou/Documents]
[path: /Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Applications/Racket:/Applications/Racket v6.1.1/bin]
I vaguely remember encountering this error when setting up Sublime Text for the first time, but now don't remember how to fix this.
Sorry, I met a similar error as well and my Macbook is also Catalina...
When I restart my Mac and try to run Python codes on Sublime Text 3 using "Python" system built by Sublime at the first time, everything is ok, but if I quit Sublime and then open it and run python codes then I will get some errors... e.g. if I "import bs4" then I will get an error "there is no module called bs4" but I do install this module by pip install (as well as pip3 because I install two kinds of Python in my Mac, one is Anaconda while another is Python 3.8)...
I don't know what happens but I think this might be kind of bug on Mac or Sublime maybe...

When Installing PIL, I get a SyntaxError

When I try and use easy_install PIL it will give me the error:
File "setup.py", line 182
print "--- using Tcl/Tk libraries at", TCL_ROOT
^
SyntaxError: invalid syntax
It is extremely annoying and I have tried installing it from a package as well. I've downloaded Imaging-1.1.7 and it gives the same error. I am trying to get the Image module in Python 3.4.1. I've tried installing Pillow 2.4 but it doesn't show up in the module list when I type pydoc3.4 modules and none of the applications even detect it's existence. Please help because I am getting desperate. I am on Mac OS X 10.8.4 with Python 3.4.1.
That syntax for print only exists in Python 2.x, where print is a statement. However, it was removed entirely in Python 3.x when print became a function.
This means that your version of PIL is incompatible with Python 3.x. So, you now have two options:
Get a version of PIL that is compatible with Python 3.x. This question has more information on that.
Downgrade to Python 2.x.
I have also tried brew install PIL and pip install PIL and I encountered the same issue, because I'm using python 3.4. But I just solved the problem today. This is thanks to Ned Deily's answer above, which i need to figure out first how to do since i'm not well experienced with pip stuffs.
So to do it, you need to head over to https://pypi.python.org/pypi/Pillow/ and click the latest version. (found version 2.6.1 at the time of this writing). You should see something like Pillow-(version).tar.gz (found Pillow-2.6.1.tar.gz). Just right click it and copy link address if you're using chrome browser and type in the following in your terminal.
pip install https://pypi.python.org/packages/source/P/Pillow/Pillow-2.6.1.tar.gz#md5=4b77fb0c81bbe0c8bf90c6eea960e091
that should do the trick

How can I update Python on Mac OS and have RubyGems use the new version?

I am having serious issues trying to download the "therubyracer" gem. I think the problem is that I do not have a working libv8 library to create the gem.
I think I do not have a working libv8 because my RubyGems keeps trying to use "Python 2.5.6", which is too old to gem install libv8. I tried countless ways to update the Python that RubyGems uses, however, I cannot figure it out.
Here is what I have done thus far. I went to http://www.python.org/download/releases/3.3.2/ and downloaded "(Mac OS X 64-bit/32-bit Installer (3.3.2) for Mac OS X 10.6 and later 2.)".
Upon completion of the download, I ran:
gem install libv8 --version 3.11.8.17
Yet, I still received the same error. I noticed the output still said:
"Using Python 2.5.4"
Despite downloading a newer Python version, it is not being used. So how do I change the version of Python that the "gem" command uses? I searched and discovered "virtualenv," which appears to be a good Python manager, however I am a bit at a dead end now. Any help or suggestion?
If libv8 uses the python command from the command line, this should apply:
If you do not care what python2 is installed, you can do this in the command line:
type python # this gives you the path of the python command
python is /usr/bin/python
type python2.7
python is /usr/bin/python2.7
Then you can copy one over the other
cp /usr/bin/python2.7 /usr/bin/python
You can safely copy python2.7 there because it is compatible with older versions.
Suggestions?

biopython test_Tutorial ... FAIL

I'm fairly new to programming. I'm trying to install biopython on mac os x 10.5.
This is what I did so far. 1. installed xcode 2. installed numpy 3. ran these commands in terminal python setup.py build python setup.py test
test reported back one fail.
test_Tutorial ... FAIL
ERROR: Run tutorial doctests.
Traceback (most recent call last): File "test_Tutorial.py", line 152, in test_doctests ValueError: 4 Tutorial doctests failed: test_from_line_05671, test_from_line_06030, test_from_line_06190, test_from_line_06479
Thanks for any help or advice.
That file test_Tutorial.py runs marked examples in the source for the main Biopython Tutorial and Cookbook ( http://biopython.org/DIST/docs/tutorial/Tutorial.html / http://biopython.org/DIST/docs/tutorial/Tutorial.pdf ) to check the examples work as expected. Internally this uses the same library as Python's doctest examples.
The fact that test_Tutorial.py failed is probably a harmless issue with a couple of examples.
Which version of Biopython are you using? If this was an official release that failure is unexpected. If it was a snapshot from the git repository then that is unfortunate. If you are curious, you could try this to see more information:
$ cd Tests
$ python test_Tutorial.py
This kind of issue might be more easily discussed on the Biopython mailing list http://biopython.org/wiki/Mailing_lists
I've found that the easiest way to set up a good programming environment is to use MacPorts, as it has a great way of ensuring that all dependencies are satisfied when installing things. You'll need to be familiar with Terminal and the command line, though.
Install MacPorts for OSX 10.5. Read the documentation too.
Restart.
Open Terminal.app and enter sudo port selfupdate to make sure the portfile definitions are up to date.
Run sudo port install py27-biopython to install the latest version of Python 2 (2.7.3), numpy, and biopython. This will take a while.
Run echo $PATH and make sure that /opt/local/bin and /opt/local/sbin` are at the beginning. They should be.
Run which python and ensure it returns /opt/local/bin/python. If it doesn't, run sudo port install python_select and follow its instructions to select your default python version.
Hopefully, at this point you can run python to enter the interactive interpreter, and import Bio won't give any errors.
Good luck!

Busted OS X Python install

So I didn't look carefully and I installed 64 bit Python2.7 on an OS X 10.5 box. This didn't work with the standard cryptic wrong-OS message "dyld: unknown required load command"
OK, fair enough
So I dragged the Python2.7 icon to the trash from Applications; then I went in with sudo and renamed the
/Library/Frameworks/Python.framework/Versions/2.7/
to
/Library/Frameworks/Python.framework/Versions/2.7BROKEN/
and installed the 32-bit Python 2.7. But I am still getting the "dyld" error. Any idea what other side effect the broken install might have had to make this possible and how I can fix it?
Problem solved by following this bug report's instructions, substituting 2.7 for 2.6 everywhere, then reinstalling.

Categories