udsleeds / openinfra

Open access data for transport research: tools, modelling and simulation
https://udsleeds.github.io/openinfra/
Other
31 stars 4 forks source link

Set-up new computer #48

Open Robinlovelace opened 2 years ago

Robinlovelace commented 2 years ago

Documenting this here, will be useful for others getting started in this space.

Robinlovelace commented 2 years ago

https://www.rstudio.com/products/rstudio/download/#download

Robinlovelace commented 2 years ago

Running this on Ubuntu terminal:

# update indices
sudo apt update -qq
# install two helper packages we need
sudo apt install --no-install-recommends software-properties-common dirmngr
# add the signing key (by Michael Rutter) for these repos
# To verify key, run gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
# Fingerprint: 298A3A825C0D65DFD57CBB651716619E084DAB9
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
# add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
sudo apt install --no-install-recommends r-base
Robinlovelace commented 2 years ago

Then for quick install of r-spatial pkgs:

sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+
Robinlovelace commented 2 years ago

After running the above you can install packages from the system command line as follows:

sudo apt install r-cran-tidyverse
Robinlovelace commented 2 years ago

Download rstudio and install with the following:

sudo dpkg -i ~/Downloads/rstudio-2022.02.1-461-amd64.deb  
Robinlovelace commented 2 years ago
sudo apt install libclang-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 libclang-dev : Depends: libclang-10-dev (>= 10~) but it is not going to be installed
 rstudio : Depends: libpq5 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Robinlovelace commented 2 years ago
sudo apt --fix-broken install 
Robinlovelace commented 2 years ago

Then this worked:

sudo dpkg -i ~/Downloads/rstudio-2022.02.1-461-amd64.deb 

:tada:

Robinlovelace commented 2 years ago

Following this for Python: https://conda.io/projects/conda/en/latest/user-guide/install/index.html

Robinlovelace commented 2 years ago

Python steps were:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda*
hulsiejames commented 2 years ago

On the differences between Miniconda and Anaconda:

  1. Number of packages: Anaconda comes with over 150 data science packages, whereas miniconda comes with only a handful

  2. Interface: Anaconda has a graphical user interface (GUI) called the Navigator, while miniconda has a command-line interface (though a command-line interface can still be used for Anaconda, should the user wish)

On choosing between Miniconda or Anaconda:

Select Anaconda if:

Select Miniconda if:

Both Anaconda and Miniconda are software distributions and both come installed with Conda, this the package manager for the two software distributions.

As described above Miniconda comes with no additional packages installed, thus Conda is used immediately to install desired packages (including basics) whereas Anaconda comes with 150 packages pre-installed and in most instances is set up ready to go. If you require any additional, non mainstream packages, Conda will be used to install these.

Source

Robinlovelace commented 2 years ago

This is a great summary, thanks @hulsiejames

hulsiejames commented 2 years ago

Following this, to install Anaconda (Miniconda covered above) run

# Downloads installer
wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh

Followed by

# Launches installer
bash Anaconda*

Once the install has completed, simply re-start your shell

:tada:

Robinlovelace commented 2 years ago

Great stuff. Worth doing a blog post on the experience? Look forward to seeing how it handles large datasets!

hulsiejames commented 2 years ago

Should be! likewise!

Been trying to get GH working within VS code this afternoon by installing 'GitHub Pull Requests and Issues' extension however have run into some issues trying to clone repos using terminal within VS code (Ctrl + Shift + P --> 'Git:Clone' --> 'geocompr/py' --> I then select a folder to clone repo locally through file finder prompt --> Git: fatal: repository 'gecompr/py' does not exist):

[2022-04-29T16:41:34.472Z] Validating found git in: git
[2022-04-29T16:41:34.512Z] Using git 2.25.1 from git
[2022-04-29T16:41:34.545Z] > git rev-parse --git-dir [1ms]
[2022-04-29T16:41:34.550Z] Open repository: /home/james/Desktop/LIDA_OSM_Project/openinfra
[2022-04-29T16:41:34.721Z] > git symbolic-ref --short HEAD [1ms]
[2022-04-29T16:41:34.725Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main [1ms]
[2022-04-29T16:41:34.733Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [5ms]
[2022-04-29T16:41:34.733Z] > git remote --verbose [2ms]
[2022-04-29T16:41:34.741Z] > git config --get commit.template [2ms]
[2022-04-29T17:07:18.527Z] > git config --local branch.main.github-pr-owner-number [1ms]
[2022-04-29T17:15:53.458Z] > git config --local branch.main.github-pr-owner-number [2ms]
[2022-04-29T17:18:21.388Z] > git clone geocompr/py /home/james/Desktop/LIDA_OSM_Project/gecompr/py --progress [1ms]
[2022-04-29T17:18:21.388Z] fatal: repository 'geocompr/py' does not exist
[2022-04-29T17:19:54.273Z] > git clone geocompr/py /home/james/Desktop/LIDA_OSM_Project/gecompr/py --progress --recursive [1ms]
[2022-04-29T17:19:54.273Z] fatal: repository 'geocompr/py' does not exist
[2022-04-29T17:20:33.649Z] > git clone udsleeds/openinfra /home/james/Desktop/LIDA_OSM_Project/test/openinfra --progress --recursive [0ms]
[2022-04-29T17:20:33.649Z] fatal: repository 'udsleeds/openinfra' does not exist

I then re-tried this using the Linux terminal (Ctrl + Alt + T, rather than a terminal within VS code) which was successful:

(base) james@robin-Proteus:~$ gh repo clone geocompr/py
Cloning into 'py'...
remote: Enumerating objects: 2485, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 2485 (delta 16), reused 24 (delta 8), pack-reused 2435
Receiving objects: 100% (2485/2485), 13.66 MiB | 5.07 MiB/s, done.
Resolving deltas: 100% (1527/1527), done.
(base) james@robin-Proteus:~$ ls
 anaconda3                           Music                           py
 Anaconda3-2021.11-Linux-x86_64.sh   openinfra-setup.sh              R
 Desktop                             Pictures                        snap
 Documents                          "PlayOnLinux's virtual drives"   Templates
 Downloads                           Public                          Videos

Note sure if Friday vibes are making me miss anything but will have a look at this over the weekend and see if i can find a solution!

Robinlovelace commented 2 years ago

Hi @hulsiejames, great to hear how you're getting on. In this case from first impressions, my advice: forget plugins for stuff like Pull Requests. Keep it simple and use the command line for everything.

My workflow: do my coding and then when I need to do anything in Git, including pull requests, press Ctl+J to open a terminal (you can cycle through terminals with Ctrl+ Page Up/Down) and then do it from there, e.g. :

git checkout -b my-new-branch
git commit -am "My new commit"
git push # ... follow the instructions
gh pr create # create a PR from the command line

Honestly simplicity is good, the fewer plugins and the cleaner your set-up the better in many case. Sound reasonable?

Robinlovelace commented 2 years ago

You need to be in the repo after cloning it obiously, e.g.

gh repo clone geocompr/py
code py/ # open VS Code in the folder then your terminal will open there when in VS Code
# or:
cd py
# ... whatever next

Does that work? Hope so!