Why importing pyspark in python3 needs superuser access on my linux machine?









up vote
1
down vote

favorite












I installed pyspark using pip3.
Whenever I try import pyspark in python3 , I get an error:




import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError:avinash@avinash-HP-ProBook-445-G1:~$ python3
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyspark'



On the other hand when I use sudo python3, everything works fine!



A similar thing happens in Jupyter notebook also, I have to do sudo jupyter notebook --allow-root to import pyspark



However, importing other packages like numpy works fine without sudo too, that too installed with pip3.



Update: I installed pyspark using sudo pip3 install pyspark , I tried uninstalling it and then installing it without sudo i.e. pip3 install pyspark but it gives error:




Could not install packages due to an EnvironmentError: [Errno 13]
Permission denied:
'/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info'
Consider using the --user option or check the permissions.




Strange thing is, there is no file named 'pyspark-2.4.0.dist-info' as mentioned in error, in the directory /usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info.



I also tried giving permission(777) to the above-mentioned directory.










share|improve this question























  • It seems you have installed pyspark using sudo pip3 install pyspark. try installing it without sudo.
    – Ali AzG
    Nov 10 at 12:48










  • Hi @AliAzG I tried that too, but it won't install without sudo Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info' Consider using the --user option or check the permissions.
    – CodeChari
    Nov 10 at 14:21















up vote
1
down vote

favorite












I installed pyspark using pip3.
Whenever I try import pyspark in python3 , I get an error:




import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError:avinash@avinash-HP-ProBook-445-G1:~$ python3
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyspark'



On the other hand when I use sudo python3, everything works fine!



A similar thing happens in Jupyter notebook also, I have to do sudo jupyter notebook --allow-root to import pyspark



However, importing other packages like numpy works fine without sudo too, that too installed with pip3.



Update: I installed pyspark using sudo pip3 install pyspark , I tried uninstalling it and then installing it without sudo i.e. pip3 install pyspark but it gives error:




Could not install packages due to an EnvironmentError: [Errno 13]
Permission denied:
'/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info'
Consider using the --user option or check the permissions.




Strange thing is, there is no file named 'pyspark-2.4.0.dist-info' as mentioned in error, in the directory /usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info.



I also tried giving permission(777) to the above-mentioned directory.










share|improve this question























  • It seems you have installed pyspark using sudo pip3 install pyspark. try installing it without sudo.
    – Ali AzG
    Nov 10 at 12:48










  • Hi @AliAzG I tried that too, but it won't install without sudo Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info' Consider using the --user option or check the permissions.
    – CodeChari
    Nov 10 at 14:21













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I installed pyspark using pip3.
Whenever I try import pyspark in python3 , I get an error:




import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError:avinash@avinash-HP-ProBook-445-G1:~$ python3
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyspark'



On the other hand when I use sudo python3, everything works fine!



A similar thing happens in Jupyter notebook also, I have to do sudo jupyter notebook --allow-root to import pyspark



However, importing other packages like numpy works fine without sudo too, that too installed with pip3.



Update: I installed pyspark using sudo pip3 install pyspark , I tried uninstalling it and then installing it without sudo i.e. pip3 install pyspark but it gives error:




Could not install packages due to an EnvironmentError: [Errno 13]
Permission denied:
'/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info'
Consider using the --user option or check the permissions.




Strange thing is, there is no file named 'pyspark-2.4.0.dist-info' as mentioned in error, in the directory /usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info.



I also tried giving permission(777) to the above-mentioned directory.










share|improve this question















I installed pyspark using pip3.
Whenever I try import pyspark in python3 , I get an error:




import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError:avinash@avinash-HP-ProBook-445-G1:~$ python3
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyspark'



On the other hand when I use sudo python3, everything works fine!



A similar thing happens in Jupyter notebook also, I have to do sudo jupyter notebook --allow-root to import pyspark



However, importing other packages like numpy works fine without sudo too, that too installed with pip3.



Update: I installed pyspark using sudo pip3 install pyspark , I tried uninstalling it and then installing it without sudo i.e. pip3 install pyspark but it gives error:




Could not install packages due to an EnvironmentError: [Errno 13]
Permission denied:
'/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info'
Consider using the --user option or check the permissions.




Strange thing is, there is no file named 'pyspark-2.4.0.dist-info' as mentioned in error, in the directory /usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info.



I also tried giving permission(777) to the above-mentioned directory.







linux python-3.x pyspark jupyter-notebook sudo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 14:24









Ali AzG

332113




332113










asked Nov 10 at 12:43









CodeChari

205




205











  • It seems you have installed pyspark using sudo pip3 install pyspark. try installing it without sudo.
    – Ali AzG
    Nov 10 at 12:48










  • Hi @AliAzG I tried that too, but it won't install without sudo Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info' Consider using the --user option or check the permissions.
    – CodeChari
    Nov 10 at 14:21

















  • It seems you have installed pyspark using sudo pip3 install pyspark. try installing it without sudo.
    – Ali AzG
    Nov 10 at 12:48










  • Hi @AliAzG I tried that too, but it won't install without sudo Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info' Consider using the --user option or check the permissions.
    – CodeChari
    Nov 10 at 14:21
















It seems you have installed pyspark using sudo pip3 install pyspark. try installing it without sudo.
– Ali AzG
Nov 10 at 12:48




It seems you have installed pyspark using sudo pip3 install pyspark. try installing it without sudo.
– Ali AzG
Nov 10 at 12:48












Hi @AliAzG I tried that too, but it won't install without sudo Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info' Consider using the --user option or check the permissions.
– CodeChari
Nov 10 at 14:21





Hi @AliAzG I tried that too, but it won't install without sudo Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pyspark-2.4.0.dist-info' Consider using the --user option or check the permissions.
– CodeChari
Nov 10 at 14:21













1 Answer
1






active

oldest

votes

















up vote
0
down vote













Based on error you get, it seems you are using Anaconda on linux. In such a case you have to install pyspark using the command below:



conda install -c conda-forge pyspark





share|improve this answer






















  • I am getting following error : PermissionError: [Errno 13] Permission denied: /home/avinash/anaconda3/.condatmp Am I supose to use it with sudo?
    – CodeChari
    Nov 12 at 12:32











  • Yes, I think you have installed Anaconda in superuser mode and now you should install it with sudo and also run Anaconda in superuser mode.
    – Ali AzG
    Nov 12 at 12:38











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239075%2fwhy-importing-pyspark-in-python3-needs-superuser-access-on-my-linux-machine%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Based on error you get, it seems you are using Anaconda on linux. In such a case you have to install pyspark using the command below:



conda install -c conda-forge pyspark





share|improve this answer






















  • I am getting following error : PermissionError: [Errno 13] Permission denied: /home/avinash/anaconda3/.condatmp Am I supose to use it with sudo?
    – CodeChari
    Nov 12 at 12:32











  • Yes, I think you have installed Anaconda in superuser mode and now you should install it with sudo and also run Anaconda in superuser mode.
    – Ali AzG
    Nov 12 at 12:38















up vote
0
down vote













Based on error you get, it seems you are using Anaconda on linux. In such a case you have to install pyspark using the command below:



conda install -c conda-forge pyspark





share|improve this answer






















  • I am getting following error : PermissionError: [Errno 13] Permission denied: /home/avinash/anaconda3/.condatmp Am I supose to use it with sudo?
    – CodeChari
    Nov 12 at 12:32











  • Yes, I think you have installed Anaconda in superuser mode and now you should install it with sudo and also run Anaconda in superuser mode.
    – Ali AzG
    Nov 12 at 12:38













up vote
0
down vote










up vote
0
down vote









Based on error you get, it seems you are using Anaconda on linux. In such a case you have to install pyspark using the command below:



conda install -c conda-forge pyspark





share|improve this answer














Based on error you get, it seems you are using Anaconda on linux. In such a case you have to install pyspark using the command below:



conda install -c conda-forge pyspark






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 11 at 11:56









Zoe

10.2k73475




10.2k73475










answered Nov 11 at 11:54









Ali AzG

332113




332113











  • I am getting following error : PermissionError: [Errno 13] Permission denied: /home/avinash/anaconda3/.condatmp Am I supose to use it with sudo?
    – CodeChari
    Nov 12 at 12:32











  • Yes, I think you have installed Anaconda in superuser mode and now you should install it with sudo and also run Anaconda in superuser mode.
    – Ali AzG
    Nov 12 at 12:38

















  • I am getting following error : PermissionError: [Errno 13] Permission denied: /home/avinash/anaconda3/.condatmp Am I supose to use it with sudo?
    – CodeChari
    Nov 12 at 12:32











  • Yes, I think you have installed Anaconda in superuser mode and now you should install it with sudo and also run Anaconda in superuser mode.
    – Ali AzG
    Nov 12 at 12:38
















I am getting following error : PermissionError: [Errno 13] Permission denied: /home/avinash/anaconda3/.condatmp Am I supose to use it with sudo?
– CodeChari
Nov 12 at 12:32





I am getting following error : PermissionError: [Errno 13] Permission denied: /home/avinash/anaconda3/.condatmp Am I supose to use it with sudo?
– CodeChari
Nov 12 at 12:32













Yes, I think you have installed Anaconda in superuser mode and now you should install it with sudo and also run Anaconda in superuser mode.
– Ali AzG
Nov 12 at 12:38





Yes, I think you have installed Anaconda in superuser mode and now you should install it with sudo and also run Anaconda in superuser mode.
– Ali AzG
Nov 12 at 12:38


















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239075%2fwhy-importing-pyspark-in-python3-needs-superuser-access-on-my-linux-machine%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3