skip to Main Content

I have a google colab file that I want to run in Visual Studio Code. Normal cells are running ok but I have the following cell:

# 1. Downloads, extracts, and sets the permissions for the Elasticsearch installation image:
%%bash

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz -q
tar -xzf elasticsearch-7.9.2-linux-x86_64.tar.gz
chown -R daemon:daemon elasticsearch-7.9.2

The problem is that I am getting SyntaxError: invalid syntax on the wget

I have tried multiple solutions from stackoverflow

  1. Use the generic %%bash I use in Google Colab too.
  2. Use %%shell
  3. Use the longer version of 1, %%script bash
  4. Use %%script bash
  5. Use the shortcut %%!

I used source like this, this. This is the tutorial I used

2

Answers


  1. Chosen as BEST ANSWER

    Ok I found the solution by myself

    # 1. Downloads, extracts, and sets the permissions for the Elasticsearch installation image:
    %%!
    
    !wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz -q
    !tar -xzf elasticsearch-7.9.2-linux-x86_64.tar.gz
    !chown -R daemon:daemon elasticsearch-7.9.2
    

    This is the correct syntax


  2. Could you run this in the VS Code terminal instead?

    1. Open a terminal (Terminal > New Terminal)
    2. Run the shell commands

    Mac / Linux

    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz -q
          
    tar -xzf elasticsearch-7.9.2-linux-x86_64.tar.gz
          
    chown -R daemon:daemon elasticsearch-7.9.2
    

    Windows

    # Download Elasticsearch tar.gz file
    curl -o elasticsearch-7.9.2-windows-x86_64.tar.gz https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-windows-x86_64.tar.gz
    
    # Extract the tar.gz file
    tar -xf elasticsearch-7.9.2-windows-x86_64.tar.gz
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search