1

I have installed Anaconda and I have used it several time. However now I want to install Pyspark and it asked me to verify if I have coherent version of java and python installed on my computer. So, I used command prompt. Unfortunately, everything is ok for java but for python: when I have written python --version it opened for me a new window to install python.

I can not understand how to handle the communication between Anaconda prompt and command prompt.

baddy
  • 369
  • 1
  • 3
  • 23
  • Does this answer your question? [How to access Anaconda command prompt in Windows 10 (64-bit)](https://stackoverflow.com/questions/47914980/how-to-access-anaconda-command-prompt-in-windows-10-64-bit) It sounds like you don't have the relevant paths included in your PATH variable, and are unable to use Anaconda using the `conda` command from a standard cmd or PowerShell terminal. That said, I'd really recommend just using Anaconda prompt instead on Windows if you're able to, it'll probably save you some frustration in the future. – JPI93 Oct 29 '20 at 15:42
  • Can I use Pyspark with Anaconda prompt? Because all the examples I found said I need to use command prompt – baddy Oct 29 '20 at 15:56
  • From what I can gather yes, providing that you have the pre-requisite Spark jars and what not available in your environment. – JPI93 Oct 29 '20 at 16:01
  • and Java is accessible from anaconda? – baddy Oct 29 '20 at 16:25
  • Yep, Anaconda prompt/PowerShell-prompt are essentially wrappers for cmd and PowerShell respectively and have access to variables/config from each as a result. The main distinction is that the Anaconda prompts provide access to `conda` without having to add these to your system or user PATH. – JPI93 Oct 29 '20 at 16:28
  • Does this answer your question? [How to run Conda?](https://stackoverflow.com/questions/18675907/how-to-run-conda) Specifically, you need to run `conda init cmd.exe` *once*, then restart the shell. – merv Oct 29 '20 at 21:36
  • In fact, with Anaconda everything works very well but I wonder why I can not see my anaconda environment with command prompt – baddy Oct 30 '20 at 08:16
  • @merv No it did not helped me because I am using windows – baddy Oct 30 '20 at 08:20
  • @baddy the Conda init answer includes both Windows and Unix instructions. – merv Oct 30 '20 at 19:59

1 Answers1

0

After reading many answers I found this solution:

1- Create my env using the next instruction :

conda create -n Spark python=3.8 ipykernel jupyter anaconda

2- The second step was : activating my env using:

activate Spark 

Here my env named Spark than after executing the last instruction I got this on my anconda prompt :

3- The 3rd step is to execute :

ipython kernel install --name Spark --user

In this case if I run python from my anconda prompt and execute :

import sys, os 
print(sys.executable)

And if I open the jupyter notebook and run :

import sys, os 
print(sys.executable)

I will find that I am using the same python.exe

baddy
  • 369
  • 1
  • 3
  • 23