1

I'm trying to install spacy for Python using Anaconda and I'm getting an odd error message:

python -m venv .env
source .env/bin/activate
conda install -c conda-forge spacy
python -m spacy download en_core_web_sm

Error Msg:

  File "<ipython-input-13-1a465315722a>", line 2
    python -m venv .env
                 ^
SyntaxError: invalid syntax

I've tried several methods and none of them are working.

Any clue how to install this?

Thanks!

3
  • Which operating system and Python version are you using? Please provide more details on the directory structure too. Commented Feb 15, 2021 at 7:11
  • 1
    I'm on MacOS and using Python 3.7, but I'm using Jupiter on the browser with Anaconda from my machine Commented Feb 15, 2021 at 19:16
  • It seems like you're running those commands in the notebook directly as if they were python code, try using the terminal instead. Commented Feb 15, 2021 at 23:39

2 Answers 2

1

Instead of creating virtual environment like this. There is an option to create virtual environments in Anaconda with required Python version.

conda create -n myenv python=3.8

To activate it :

source activate myenv   # (in linux, you can use . as a shortcut for "source")
activate myenv          # (in windows - note that you should be in your c:\anaconda2 directory)
Sign up to request clarification or add additional context in comments.

3 Comments

For some reason this one's telling me the create command does not exist
Do you write this directly on the Jupyter notebook?
@Jason : Please refer this link stackoverflow.com/questions/48174935/…
0

Try running these commands into the terminal instead of the Jupyter Notebook cells directly. If you still want to do it that way, make it right by adding a ! in the beginning.

!python -m venv .env
!source .env/bin/activate
!conda install -c conda-forge spacy
!python -m spacy download en_core_web_sm

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.