50

having an issue today when I started up my laptop (Ubuntu 18.4) and trying to use pip to install packages, I'm met with this error:

Error processing line 3 of /home/cjones/.local/lib/python3.6/site-packages/googleapis_common_protos-1.5.8-py3.6-nspkg.pth: Traceback (most recent call last): File "/usr/lib/python3.6/site.py", line 174, in addpackage exec(line) File "<string>", line 1, in <module> File "<frozen importlib._bootstrap>", line 568, in module_from_spec AttributeError: 'NoneType' object has no attribute 'loader' Remainder of file ignored 

I don't think I changed anything since last successful boot but it seems as though something is missing... can anyone help?

9 Answers 9

82

Delete /home/cjones/.local/lib/python3.6/site-packages/googleapis_common_protos-1.5.8-py3.6-nspkg.pth and retry.

Sign up to request clarification or add additional context in comments.

2 Comments

Would be good to give an explanation on how this works? I had this error and was due to an old package that had been moved/renmaed, but the .pth file still pointing at the original location
I believe what they mean if you have an error Error processing line 3 of file_name just get rid of the file_name causing error.
24

I had the similar problem, but the error message referenced a different .pth file. The error message I received was:

Error processing line 1 of /Users/jt/anaconda3/lib/python3.7/site-packages/sphinxcontrib.datatemplates-nspkg.pth: Traceback (most recent call last): File "/Users/jt/anaconda3/lib/python3.7/site.py", line 168, in addpackage exec(line) File "<string>", line 1, in <module> File "<frozen importlib._bootstrap>", line 580, in module_from_spec AttributeError: 'NoneType' object has no attribute 'loader' Remainder of file ignored 

Following the solution described here:

https://github.com/Pyomo/pyomo/issues/95

I edited the .pth file (the file at the start of the error message, immediately after the text Error processing line 1 of) and added a newline character after the first semicolon. That is, I changed:

import sys, types, os;has_mfs = sys.version_info > (3, 5);p ...<rest of file> 

To:

import sys, types, os; has_mfs = sys.version_info > (3, 5);p ...<rest of file> 

I don't know why this worked, but it did.

Comments

5

I had a similar error with my virtual environments on a mac, but referring to matplotlib:

Error processing line 1 of //anaconda3/lib/python3.7/site-packages/matplotlib-3.1.3-py3.7-nspkg.pth:

As in the previous answer, it was solved by changing the file mentioned:

import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).$ 

to this, via a linebreak:

import sys, types, os; has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).$ 

Comments

4

the line is too long for pip3 to process. You can reinstall googleapis_common_protos to fix this problem. it means you can run this:

pip uninstall googleapis_common_protos and pip install googleapis_common_protos

Comments

1

I had to do :0,$s/;/;\r/g in vi.

it looks like a line is too long for pip3 to process. Basically, some packages put all commands on one line and that overflows a buffer somewhere.

This vi command puts a carriage return after every semicolon. (It is possible a newline (\n) would work instead of a carriage return.)

Breakdown of the command:

: - use ED line editor command 0,$ - run on all lines s - regular expression substitution / - delimiter start search ; - replace semicolon with / - delimiter end search start replace ;\r - replace with semicolon followed by carriage return / - delimiter end replace g - global - do more than once per line. 

This is a very common vi command. If you need to replace a "/", you can use another character as the delimiter - the first character after "s" is the delimiter

2 Comments

can you please be more clear in your instructions?
it looks horrible, please elaboarate
0

I faced similar issue and

> rm -f /Users/boss/opt/anaconda3/lib/python3.9/site-packages/googleapis_common_protos-1.57.0-py3.9-nspkg.pth 

solve the problem, for now.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
0

I solved it by just uninstalling googleapis_common_protos with:

pip uninstall googleapis_common_protos 

and installing it back with:

pip install googleapis_common_protos 

Comments

-1

I seperated all lines with ; especially adding a ; where none was present. For example: (p not in mp) and mp.append(p) to (p not in mp) and mp.append(p);

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
-1

SOLUTION - FIX:

  1. https://ubuntu.pkgs.org/18.04/ubuntu-main-amd64/python3-pastescript_2.0.2-2_all.deb.html

  2. Download: python3-pastescript_2.0.2-2_all.deb

Download: http://archive.ubuntu.com/ubuntu/pool/main/p/pastescript/python3-pastescript_2.0.2-2_all.deb

  1. Force Install:

┌──(chacka0101㉿kali)-[~/Downloads]

└─$ sudo dpkg -i --force-overwrite python3-pastescript_2.0.2-2_all.deb

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.