KarthikRIyer/swiftplot

Fails to install in Colab

rickwierenga opened this issue · 13 comments

I was trying to install SwiftPlot in Colab, but got an error at installation. It's the first cell to be run.

Code:

%install-swiftpm-flags -Xcc -isystem/usr/include/freetype2 -Xswiftc -lfreetype
%install '.package(url: "https://github.com/KarthikRIyer/swiftplot", from: "1.0.0")' SwiftPlot

Error:

Installing packages:
	.package(url: "https://github.com/KarthikRIyer/swiftplot", from: "1.0.0")
		SwiftPlot
With SwiftPM flags: ['-Xcc', '-isystem/usr/include/freetype2', '-Xswiftc', '-lfreetype']
Working in: /tmp/tmpsmep6x4c/swift-install
Updating https://github.com/KarthikRIyer/swiftplot
error: the package swiftplot[https://github.com/KarthikRIyer/swiftplot] @ 1.0.0 contains incompatible dependencies:
    cfreetype[https://github.com/KarthikRIyer/CFreeType.git] @ master
Install Error: swift-build returned nonzero exit code 1.

Let me know if you need additional information.

karwa commented

There seems to be a problem with the separate freetype package (see #37), which the tagged version 1.0.0 is still using. Switch to master instead:

%install-swiftpm-flags -Xcc -isystem/usr/include/freetype2 -Xswiftc -lfreetype
%install '.package(url: "https://github.com/KarthikRIyer/swiftplot", .branch("master"))' SwiftPlot AGGRenderer

Also, you need to tell it to build the AGGRenderer now by adding that alongside "SwiftPlot".

@rickwierenga you also need to include this in the 1st cell:
%install '.package(url: "https://github.com/IBM-Swift/BlueCryptor.git", from: "1.0.28")' Cryptor

I dont know why I included it in the swift-jupyter docs but missed it here. Anyways, I've updated the docs.

So I installed it and everything is imported correctly. However, nothing is showing in the notebook. I inspected the base64 encoded image and it's almost completely filled with A (pastebin). I don't think this really represents an image... This is supposed a plot of just 15 points. Does anyone know if this is a common issue?

@rickwierenga This has happened before with me, but I am not sure why. I'm trying to figure it out. Till then you could use the compiler in the terminal, or xcode to get started. SwiftPlot doesn't require the S4TF toolchain.

@rickwierenga I don't know for sure but I don't think the problem is on SwiftPlot's side. A test has been added recently checking if the base64 encoding works. That doesn't seem to fail. I tried plotting using swift-jupyter. It works when I try plotting for the first time, but when I re-execute the cell with the plotting code, I get the same issue. I've asked Marc Rasi, who works on swift-jupyter, about this issue. You could try using swift-jupter or work with xcode or terminal for now.

@rickwierenga it should now work in swift-jupyter. But it still doesn't work on colab.

swift-jupyter isn't working still

@rickwierenga have you tried using the linux port of swift?

SwiftPlot with Linux port of swift seems to be working fine. swift-jupyter is also giving me some difficulty. @boronhub @rickwierenga are you getting the same issue as #77?

#77 seems to be fixed. Colab works too, despite a lot of warnings generated by the Swift compiler. See this example.

Unfortunately, live view does not work in Colab but I doubt that's an error in SwiftPlot. It is possible to download the image and view it locally. I have not tested it on a Linux machine so I'm not sure if it works there.

👍 That's great everything is working now with the install and usage. I actually have an idea to get live view working on Colab btw, will update later. @rickwierenga Are you planning on working on the SwiftPlot task soon?

It would be great if live view were supported. Let me know if you need help implementing it.

@WilliamHYZhang I'm actually doing a Python TensorFlow task now, but I hope to make a contribution to SwiftPlot before the contest ends.

Great, sounds good!