KarthikRIyer / swiftplot

Swift library for Data Visualization :bar_chart:
Apache License 2.0
400 stars 39 forks source link

Fail to install in docker #122

Closed clsx524 closed 4 years ago

clsx524 commented 4 years ago

Hi, I tried to install it in a custom ubuntu 18.04 docker. The swift tool chain is https://storage.googleapis.com/swift-tensorflow-artifacts/nightlies/latest/swift-tensorflow-DEVELOPMENT-x10-cuda10.1-cudnn7-ubuntu18.04.tar.gz

The swift kernel is added according to swift-jupyter by python register.py --sys-prefix --swift-toolchain <path to extracted swift toolchain directory>

In my notebook, I only have

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

From a fresh run, I got

Installing packages:
    .package(url: "https://github.com/IBM-Swift/BlueCryptor.git", from: "1.0.32")
        Cryptor
    .package(url: "https://github.com/KarthikRIyer/swiftplot", .branch("master"))
        SwiftPlot
        AGGRenderer
With SwiftPM flags: ['-Xcc', '-isystem/usr/include/freetype2', '-Xswiftc', '-lfreetype']
Working in: /tmp/tmppijn_w4h/swift-install
Fetching https://github.com/KarthikRIyer/swiftplot
Fetching https://github.com/IBM-Swift/BlueCryptor.git
Fetching https://github.com/IBM-Swift/OpenSSL.git
Cloning https://github.com/IBM-Swift/BlueCryptor.git
Resolving https://github.com/IBM-Swift/BlueCryptor.git at 1.0.32
Cloning https://github.com/KarthikRIyer/swiftplot
Resolving https://github.com/KarthikRIyer/swiftplot at master
Cloning https://github.com/IBM-Swift/OpenSSL.git
Resolving https://github.com/IBM-Swift/OpenSSL.git at 2.2.2
warning: failed to retrieve search paths with pkg-config; maybe pkg-config is not installed
warning: you may be able to install freetype2 using your system-packager:
    apt-get install libfreetype6-dev

warning: you may be able to install openssl using your system-packager:
    apt-get install openssl libssl-dev

<module-includes>:1:1: warning: umbrella header for module 'CPPAGGRenderer' does not include header 'savebmp.h' [-Wincomplete-umbrella]
#include "/tmp/tmppijn_w4h/swift-install/package/.build/checkouts/swiftplot/Sources/AGGRenderer/CPPAGGRenderer/include/CPPAGGRenderer.h"
^
<module-includes>:1:1: warning: umbrella header for module 'CPPAGGRenderer' does not include header 'pixel_formats.h' [-Wincomplete-umbrella]
[1/45] Compiling AGG gpc.c
[2/49] Compiling agg_scale_ctrl.cpp
[3/56] Compiling agg_slider_ctrl.cpp
[4/60] Compiling agg_spline_ctrl.cpp
[5/63] Compiling agg_rbox_ctrl.cpp
[6/89] Compiling agg_gamma_spline.cpp
[7/89] Compiling agg_polygon_ctrl.cpp
2 warnings generated.
[8/89] Compiling CAGGRenderer CAGGRenderer.cpp
[9/89] Compiling AGG agg_vpgen_segmentator.cpp
[10/89] Compiling agg_gamma_ctrl.cpp
[11/89] Compiling agg_cbox_ctrl.cpp
[12/89] Compiling AGG agg_vpgen_clip_polyline.cpp
[13/89] Compiling AGG agg_vpgen_clip_polygon.cpp
[14/89] Compiling agg_bezier_ctrl.cpp
[15/89] Compiling AGG agg_vcgen_smooth_poly1.cpp
[16/89] Compiling AGG agg_vcgen_stroke.cpp
[17/89] Compiling AGG agg_vcgen_markers_term.cpp
[18/89] Compiling AGG agg_vcgen_dash.cpp
[19/89] Compiling AGG agg_trans_warp_magnifier.cpp
[20/89] Compiling AGG agg_vcgen_bspline.cpp
[21/89] Compiling lodepng lodepng.cpp
[22/89] Compiling AGG agg_vcgen_contour.cpp
[23/89] Compiling AGG agg_rounded_rect.cpp
[24/89] Compiling AGG agg_sqrt_tables.cpp
[25/89] Compiling AGG agg_trans_single_path.cpp
[26/89] Compiling AGG agg_trans_affine.cpp
[27/89] Compiling AGG agg_trans_double_path.cpp
[28/89] Compiling AGG agg_line_profile_aa.cpp
[29/89] Compiling AGG agg_image_filters.cpp
[30/89] Compiling AGG agg_line_aa_basics.cpp
[31/89] Compiling AGG agg_color_rgba.cpp
[32/89] Compiling AGG agg_bspline.cpp
[33/89] Compiling AGG agg_curves.cpp
[34/89] Compiling AGG agg_bezier_arc.cpp
[35/89] Compiling AGG agg_gsv_text.cpp
[36/89] Compiling AGG agg_embedded_raster_fonts.cpp
[37/89] Compiling AGG agg_arc.cpp
[38/89] Compiling AGG agg_arrowhead.cpp
[39/89] Compiling AGG agg_font_freetype.cpp
[40/89] Compiling CPPAGGRenderer CPPAGGRenderer.cpp
/tmp/tmppijn_w4h/swift-install/package/.build/checkouts/BlueCryptor/Sources/Cryptor/Updatable.swift:68:4: warning: using '_' to ignore the result of a Void-returning function is redundant
                        _ = data.withUnsafeBytes() {
                        ^~~~

Install Error: swift-build returned nonzero exit code 1.

Is there a way to show the actual errors?

I added -v to the flags %install-swiftpm-flags -v -Xcc -isystem/usr/include/freetype2 -Xswiftc -lfreetype

It prints tons of logs and the last one is

/home/xxx/usr/bin/clang -target x86_64-unknown-linux-gnu --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=AGG -I /tmp/tmpy_la496u/swift-install/package/.build/checkouts/swiftplot/Sources/AGG/include -fmodule-map-file=/tmp/tmpy_la496u/swift-install/package/.build/checkouts/swiftplot/Sources/CFreeType/module.modulemap -fmodules-cache-path=/tmp/tmpy_la496u/swift-install/package/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -isystem/usr/include/freetype2 -MD -MT dependencies -MF /tmp/tmpy_la496u/swift-install/package/.build/x86_64-unknown-linux-gnu/debug/AGG.build/agg_arc.cpp.d -std=c++11 -c /tmp/tmpy_la496u/swift-install/package/.build/checkouts/swiftplot/Sources/AGG/agg_arc.cpp -o /tmp/tmpy_la496u/swift-install/package/.build/x86_64-unknown-linux-gnu/debug/AGG.build/agg_arc.cpp.o
Install Error: swift-build returned nonzero exit code 1.

Another interesting finding is if I run the cell again without resetting the environment, I am able to build it and print graphs using this library.

Installing packages:
    .package(url: "https://github.com/IBM-Swift/BlueCryptor.git", from: "1.0.32")
        Cryptor
    .package(url: "https://github.com/KarthikRIyer/swiftplot", .branch("master"))
        SwiftPlot
        AGGRenderer
With SwiftPM flags: ['-Xcc', '-isystem/usr/include/freetype2', '-Xswiftc', '-lfreetype']
Working in: /tmp/tmpyene__wr/swift-install
[1/37] Compiling SwiftPlot ColorMapData.swift
[2/47] Compiling SwiftPlot FloatConvertible.swift
[3/49] Compiling SwiftPlot Rect.swift
/tmp/tmpyene__wr/swift-install/package/.build/checkouts/BlueCryptor/Sources/Cryptor/Updatable.swift:68:4: warning: using '_' to ignore the result of a Void-returning function is redundant
                        _ = data.withUnsafeBytes() {
                        ^~~~

[4/49] Compiling SwiftPlot AdaptersNamespace.swift
[5/49] Compiling SwiftPlot Axis.swift
[6/49] Compiling SwiftPlot Size.swift
[7/49] Compiling SwiftPlot HistogramSeriesOptions.swift
[8/49] Compiling SwiftPlot Label.swift
[9/49] Compiling SwiftPlot LayoutComponent.swift
[10/49] Compiling SwiftPlot Spacing.swift
[11/49] Compiling SwiftPlot EdgeComponents.swift
/tmp/tmpyene__wr/swift-install/package/.build/checkouts/BlueCryptor/Sources/Cryptor/StreamCryptor.swift:188:21: warning: static property 'none' produces an empty option set
                public static let none = Options(rawValue: 0)
                                  ^
/tmp/tmpyene__wr/swift-install/package/.build/checkouts/BlueCryptor/Sources/Cryptor/StreamCryptor.swift:188:21: note: use [] to silence this warning
                public static let none = Options(rawValue: 0)
                                  ^             ~~~~~~~~~~~~~
                                                ([])
[12/49] Compiling SwiftPlot BarChart.swift
[13/49] Compiling SwiftPlot BarGraphSeriesOptions.swift
[14/49] Compiling SwiftPlot Color.swift
[15/49] Compiling SwiftPlot ColorMap.swift
[16/50] Compiling SwiftPlot ScatterPlotSeriesOptions.swift
[17/50] Compiling SwiftPlot SequencePlots.swift
[18/50] Compiling SwiftPlot Series.swift
[19/50] Compiling SwiftPlot SubPlot.swift
[20/50] Merging module Cryptor
[21/50] Wrapping AST for Cryptor for debugging
[24/50] Compiling SwiftPlot GraphLayout.swift
[25/50] Compiling SwiftPlot Heatmap-adapter.swift
[26/50] Compiling SwiftPlot Heatmap.swift
/tmp/tmpyene__wr/swift-install/package/.build/checkouts/swiftplot/Sources/SwiftPlot/Histogram.swift:283:21: warning: initialization of immutable value 'series' was never used; consider replacing with assignment to '_' or removing it
                let series = allSeries[seriesIdx]
                ~~~~^~~~~~
                _
[27/50] Compiling SwiftPlot HelperFunction.swift
/tmp/tmpyene__wr/swift-install/package/.build/checkouts/swiftplot/Sources/SwiftPlot/Histogram.swift:283:21: warning: initialization of immutable value 'series' was never used; consider replacing with assignment to '_' or removing it
                let series = allSeries[seriesIdx]
                ~~~~^~~~~~
                _
[28/50] Compiling SwiftPlot Histogram.swift
/tmp/tmpyene__wr/swift-install/package/.build/checkouts/swiftplot/Sources/SwiftPlot/Histogram.swift:283:21: warning: initialization of immutable value 'series' was never used; consider replacing with assignment to '_' or removing it
                let series = allSeries[seriesIdx]
                ~~~~^~~~~~
                _
[29/50] Compiling SwiftPlot HistogramSeries.swift
/tmp/tmpyene__wr/swift-install/package/.build/checkouts/swiftplot/Sources/SwiftPlot/Histogram.swift:283:21: warning: initialization of immutable value 'series' was never used; consider replacing with assignment to '_' or removing it
                let series = allSeries[seriesIdx]
                ~~~~^~~~~~
                _
[30/50] Compiling SwiftPlot PlotMarkers.swift
[31/50] Compiling SwiftPlot PlotStyleHelpers.swift
[32/50] Compiling SwiftPlot Renderer.swift
[33/50] Compiling SwiftPlot ScatterChart.swift
[43/50] Compiling SwiftPlot LineChart.swift
[44/50] Compiling SwiftPlot Pair.swift
[45/50] Compiling SwiftPlot Plot.swift
[46/50] Compiling SwiftPlot PlotDimensions.swift
[47/51] Merging module SwiftPlot
[48/52] Wrapping AST for SwiftPlot for debugging
[49/52] Compiling AGGRenderer AGGRenderer.swift
[50/53] Merging module AGGRenderer
[51/54] Wrapping AST for AGGRenderer for debugging
[52/54] Compiling jupyterInstalledPackages jupyterInstalledPackages.swift
[53/55] Merging module jupyterInstalledPackages
[54/55] Wrapping AST for jupyterInstalledPackages for debugging
[55/55] Linking libjupyterInstalledPackages.so
Initializing Swift...
Installation complete!
KarthikRIyer commented 4 years ago

I'm not sure why this is happening. I haven't tested with the cuda toolchain. But it works with the instructions here: https://github.com/KarthikRIyer/swiftplot/blob/master/Swiftplot_Docker_setup.md

The issue might be on the side of swift-jupyter (because it works for you the second time you execute the cell). Maybe @marcrasi might be able to shed some light on this?

nimrodsun commented 4 years ago

Hi, is swiftplot still being maintained?

I tried the above and it didn't seem to work.

KarthikRIyer commented 4 years ago

Hi, @nimrodsun

I occasionally take a look at comments/issues but haven't been able to find the time to actively work on/maintain SwiftPlot.

I'm not sure why it doesn't work with the custom docker. That might need more investigation.

Did you follow these steps: https://github.com/KarthikRIyer/swiftplot/blob/master/Swiftplot_Docker_setup.md

Also, what error are you getting?

kongzii commented 4 years ago

I can confirm the issue, but I could not find a solution :( The message:

In file included from <module-includes>:8:
/usr/src/.build/checkouts/swiftplot/Sources/AGG/include/agg_blur.h:1490:28: error: no template named 'renderer_base'; did you mean 'blender_base'?

Its interesting that it fails only like 3 from 5 attemps.

clsx524 commented 4 years ago

I tried again just then, seems resolved somehow.