Fastai library installation

I have been trying to install the fastai library. When I did this using pip it works fine and the fastai library is available for any project I create using the relevant conda environment.

After reading the comments on the github site that it is better to clone the git hub repo rather than do this I did the same and followed the instructions. I now find that the conda environment created does not have the fastai module and hence you need to refer to the directory in which the modules are located in order to use them. This is not an insurmountable problem, however, it would be much more convenient if there were a way to cause the conda environment to be made to point to the relevant directory automatically. I it can be avoided I don’t want to hard code this into a notebook since I often work across machines and this would make it cumbersome.

I don’t know if there is an easy answer anybody can help with but if there is that would be brilliant:slight_smile:

1 Like

I create a symlink from the folder where I start the jupyter notebook to the library like so ln -s /path/to/fastai/fastai and import things normally as I would if it was installed via pip.

Thanks. thats a great solution and much more elegant than trying to do something in the notebook itself. The only thing I need to check is how well this works on a cloud based solution such as Dropbox, which is where I tend to keep the files to enable working on them from different machines. I’ll try it out and see

When you have a few minutes of time I would recommend checking out git :slight_smile: There is a bit of a learning curve but in the longer run it saves you a lot of time vs using dropbox for keeping track of your code across multiple locations.

Been dabbling with it but guess I should take the plunge! It would certainly make managing this sort of problem easier. Thanks for advice.

Hey, @radek, beginner question on this topic:

so you have a git repo for the fastai in one directory,

and (perhaps) a separate git repo for your project in another directory,

and a symlink from /project to /path/to/fastai/fastai.

The symlink just gets committed as part of the project, as per this s/o answer?

Thanks!

Hey! :slight_smile: You could also create a .gitignore file in the root of your repo. Executing this from the command line should do the trick: echo "fastai" > .gitignore. You then commit the .gitignore and can store it in your repo. This way you can specify files / folders to ignore (data, models, etc)

1 Like

Great - thank you!

1 Like

Nice trick with simulink, I used option --notebook-dir to start my jupyter notebook directly in my fast.ai project directory, see below:
jupyter notebook --notebook-dir=C:\Users\myname\Documents\fast.ai

Hope it helps!
Neil