vertexcite / haskellDoTfPlay

A simple HaskellDo with Tensorflow demo
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

multiple local packages issues #1

Closed vincent-hui closed 6 years ago

vincent-hui commented 6 years ago

Hi,

I followed your instructions to try haskellDoTfPlay on Ubuntu 16.04.4. When I run "stack build && stack exec run-test > demo.html && open demo.html", I get the following error.

The same package name is used in multiple local packages

haskellDoTfPlay used in:
- PLOther (PLFilePath ".")
- PLOther (PLFilePath ".")

tensorflow-logging used in:
- PLIndex "tensorflow-logging-0.1.0.0"
- PLOther (PLRepo (Repo {repoUrl = "https://github.com/tensorflow/haskell.git", repoCommit = "4ab9cb9cf274e88eababfaba85103e3890a96afc", repoType = RepoGit, repoSubdirs = "tensorflow-logging"}))

How to solve this issue?

Thanks

vertexcite commented 6 years ago

Same error happens for me now on Mac OS X, it has been many months since I last built this, so probably something about stack or tensorflow has changed in the interim. I'll dig around to see what can be done.

vertexcite commented 6 years ago

Bumped TF "version", and Stack resolver, works for me now (see 7eb12cb7 ) @vincent-hui Please try this latest commit.

vincent-hui commented 6 years ago

Hi @vertexcite,

I pulled the latest code and then run "stack build && stack exec run-test > demo.html && open demo.html" on Ubuntu 16.04.4 again. I got the following error.

tensorflow-0.1.0.2: configure (lib)
Progress 0/8: tensorflow-0.1.0.2

--  While building custom Setup.hs for package tensorflow-0.1.0.2 using:
      /home/vincent/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.0.1.0 configure --with-ghc=/home/vincent/.stack/programs/x86_64-linux/ghc-8.2.2/bin/ghc --with-ghc-pkg=/home/vincent/.stack/programs/x86_64-linux/ghc-8.2.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/vincent/.stack/snapshots/x86_64-linux/lts-11.9/8.2.2/pkgdb --package-db=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/pkgdb --libdir=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/lib --bindir=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/bin --datadir=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/share --libexecdir=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/libexec --sysconfdir=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/etc --docdir=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/doc/tensorflow-0.1.0.2 --htmldir=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/doc/tensorflow-0.1.0.2 --haddockdir=/home/vincent/haskellDoTfPlay/.stack-work/install/x86_64-linux/lts-11.9/8.2.2/doc/tensorflow-0.1.0.2 --dependency=async=async-2.1.1.1-K429Y4XjamzDpSomhW85Gx --dependency=attoparsec=attoparsec-0.13.2.2-3s3CgsAU1UREeeuHUZFQiP --dependency=base=base-4.10.1.0 --dependency=bytestring=bytestring-0.10.8.2 --dependency=containers=containers-0.5.10.2 --dependency=data-default=data-default-0.7.1.1-HxP9sk0JsrKFuLVc9OIluX --dependency=exceptions=exceptions-0.8.3-CYMTujxEbkkJnOJ7pW82ZD --dependency=fgl=fgl-5.6.0.0-LaOHCaDhhvrIpCcjyjtThJ --dependency=lens-family=lens-family-1.2.2-J7SkuObztkyGbsAmeDsUz1 --dependency=mainland-pretty=mainland-pretty-0.6.1-6SiE6efCmnfH1MqKBa6EPv --dependency=mtl=mtl-2.2.2-8XubxMJDT8QLsstvlNotkc --dependency=proto-lens=proto-lens-0.2.2.0-8A8uN8od7NhKD2fMEfZLZW --dependency=semigroups=semigroups-0.18.4-mxkGq2xNPcBC0dj8uuk3q --dependency=split=split-0.2.3.3-69JBPqG5rhJEaFzFyiVOGW --dependency=temporary=temporary-1.2.1.1-468ctV5wSju4LIYhvyQeLr --dependency=tensorflow-proto=tensorflow-proto-0.1.0.0-1tOJ3riAqQVAuMeKXpRTiF --dependency=text=text-1.2.3.0-8nD60G3tOYT3Qi8GaESeB5 --dependency=transformers=transformers-0.5.2.0 --dependency=vector=vector-0.12.0.1-JlawpRjIcMJIYPJVsWriIA --extra-include-dirs=/usr/local/opt/icu4c/include --extra-lib-dirs=/usr/local/opt/icu4c/lib --enable-benchmarks
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/vincent/haskellDoTfPlay/.stack-work/logs/tensorflow-0.1.0.2.log

    Configuring tensorflow-0.1.0.2...
    Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2: Missing dependency on a foreign
    library:
    * Missing C library: tensorflow
    This problem can usually be solved by installing the system package that
    provides this library (you may need the "-dev" version). If the library is
    already installed but in a non-standard location then you can use the flags
    --extra-include-dirs= and --extra-lib-dirs= to specify where it is.

How to solve this issue?

Thanks

vertexcite commented 6 years ago

@vincent-hui You first need to figure out how to get the https://github.com/tensorflow/haskell tests running and passing. https://github.com/tensorflow/haskell/README.md suggests using either Docker or Nix. I just tried using nix, and it worked. There's probably an easier way, but this worked (This is a bit perverse, running stack inside a nix-shell, and only for the native dependencies): Goto https://nixos.org/nix/ and click "Get Nix", and follow the instructions to setup Nix. Then, Once you have Nix is working, this worked for me:

$ git clone --recursive https://github.com/tensorflow/haskell.git tensorflow-haskell
$ cd tensorflow-haskell
$ nix-shell
$ cd ../haskellDoTfPlay
$ stack build && stack exec run-test > demo.html && open demo.html
vincent-hui commented 6 years ago

I installed https://github.com/tensorflow/haskell successfully. I can get the https://github.com/tensorflow/haskell tests running and passing even without installing C lbirary of tensorflow.

However when I run "stack build && stack exec run-test > demo.html && open demo.html". The demo requires C lbirary of tensorflow. I need to install C lbirary of tensorflow manually. That means stack does not install C lbirary of tensorflow for me.

Is it possible to let stack install C lbirary of tensorflow for users?

https://www.tensorflow.org/install/install_c

Thanks a lot

vertexcite commented 6 years ago

@vincent-hui Are you running the https://github.com/tensorflow/haskell tests from inside a nix shell? If so, then run the "stack build && stack exec run-test > demo.html && open demo.html" inside the same nix shell. The nix shell has essentially installed the tensorflow C library (i.e. native library) automatically for you.

As far as I know, it is not easy, maybe not even possible, to get stack to handle installing native dependencies in a cross-platform manner, which is why many projects, e.g. tensorflow/haskell, opt for nix.

vincent-hui commented 6 years ago

I can pass https://github.com/tensorflow/haskell tests and build haskellDoTfPlay with nix-sell. However when I run run-test, I got the following error.

[nix-shell:~/worksapce/haskellDoTfPlay]$ stack --nix exec run-test > demo.html && open demo.html
2018-08-09 15:58:53.095040: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2
Couldn't get a file descriptor referring to the console

tensorflow-haskell test passed

nix-sell
[nix-shell:~/worksapce/tensorflow-haskell]$ stack --nix test
optparse-applicative-0.14.2.0: configure    
optparse-applicative-0.14.2.0: build        
optparse-applicative-0.14.2.0: copy/register
tensorflow-0.2.0.0: test (suite: FFITest)   
tensorflow-0.2.0.0: Test suite FFITest passed
tensorflow-0.2.0.0: test (suite: VarIntTest)
tensorflow-0.2.0.0: Test suite VarIntTest passed
tensorflow-opgen-0.2.0.0: configure (lib)
tensorflow-opgen-0.2.0.0: build (lib)  
tensorflow-opgen-0.2.0.0: copy/register
tensorflow-core-ops-0.2.0.0: configure (lib)
tensorflow-core-ops-0.2.0.0: build (lib)  
tensorflow-core-ops-0.2.0.0: copy/register
tensorflow-ops-0.2.0.0: configure (lib + test)
tensorflow-ops-0.2.0.0: build (lib + test)
tensorflow-ops-0.2.0.0: copy/register
tensorflow-logging-0.2.0.0: configure (lib + test)
tensorflow-logging-0.2.0.0: build (lib + test)
tensorflow-logging-0.2.0.0: copy/register
tensorflow-logging-0.2.0.0: test (suite: LoggingTest)
tensorflow-logging-0.2.0.0: Test suite LoggingTest passed
Building all executables for `tensorflow-mnist' once. After a successful build of all of them, only specified executables will be rebuilt.
tensorflow-mnist-0.1.0.0: configure (lib + exe + test)
tensorflow-mnist-0.1.0.0: build (lib + exe + test)
tensorflow-mnist-0.1.0.0: copy/register
tensorflow-mnist-0.1.0.0: test (suite: ParseTest)
tensorflow-mnist-0.1.0.0: Test suite ParseTest passed
tensorflow-ops-0.2.0.0: test (suite: ArrayOpsTest)
tensorflow-ops-0.2.0.0: Test suite ArrayOpsTest passed
tensorflow-ops-0.2.0.0: test (suite: BuildTest)
tensorflow-ops-0.2.0.0: Test suite BuildTest passed
tensorflow-ops-0.2.0.0: test (suite: DataFlowOpsTest)
tensorflow-ops-0.2.0.0: Test suite DataFlowOpsTest passed
tensorflow-ops-0.2.0.0: test (suite: EmbeddingOpsTest)
tensorflow-ops-0.2.0.0: Test suite EmbeddingOpsTest passed
tensorflow-ops-0.2.0.0: test (suite: GradientTest)
tensorflow-ops-0.2.0.0: Test suite GradientTest passed
tensorflow-ops-0.2.0.0: test (suite: MatrixTest)
tensorflow-ops-0.2.0.0: Test suite MatrixTest passed
tensorflow-ops-0.2.0.0: test (suite: MiscTest)
tensorflow-ops-0.2.0.0: Test suite MiscTest passed
tensorflow-ops-0.2.0.0: test (suite: NNTest)
tensorflow-ops-0.2.0.0: Test suite NNTest passed
tensorflow-ops-0.2.0.0: test (suite: OpsTest)
tensorflow-ops-0.2.0.0: Test suite OpsTest passed
tensorflow-ops-0.2.0.0: test (suite: QueueTest)
tensorflow-ops-0.2.0.0: Test suite QueueTest passed
tensorflow-ops-0.2.0.0: test (suite: RegressionTest)
tensorflow-ops-0.2.0.0: Test suite RegressionTest passed
tensorflow-ops-0.2.0.0: test (suite: TracingTest)
tensorflow-ops-0.2.0.0: Test suite TracingTest passed
tensorflow-ops-0.2.0.0: test (suite: TypesTest)
tensorflow-ops-0.2.0.0: Test suite TypesTest passed
tensorflow-ops-0.2.0.0: test (suite: VariableTest)
tensorflow-ops-0.2.0.0: Test suite VariableTest passed
tensorflow-records-0.1.0.0: test (suite: RecordsTest)
tensorflow-records-0.1.0.0: Test suite RecordsTest passed
Log files have been written to: /home/vincent/worksapce/tensorflow-haskell/.stack-work/logs/
Completed 11 action(s). 

haskellDoTfPlay build succeeded

[nix-shell:~/worksapce/haskellDoTfPlay]$ stack --nix build
base-compat-0.9.3: download     
base-compat-0.9.3: configure    
base-compat-0.9.3: build        
base-compat-0.9.3: copy/register
blaze-markup-0.8.2.1: download     
blaze-markup-0.8.2.1: configure    
blaze-markup-0.8.2.1: build        
blaze-markup-0.8.2.1: copy/register
blaze-html-0.9.0.1: download       
blaze-html-0.9.0.1: configure    
blaze-html-0.9.0.1: build        
blaze-html-0.9.0.1: copy/register
css-text-0.1.3.0: download       
css-text-0.1.3.0: configure    
css-text-0.1.3.0: build        
css-text-0.1.3.0: copy/register
microlens-0.4.8.3: download     
microlens-0.4.8.3: configure    
microlens-0.4.8.3: build        
microlens-0.4.8.3: copy/register
microlens-th-0.4.1.3: download     
microlens-th-0.4.1.3: configure    
microlens-th-0.4.1.3: build        
microlens-th-0.4.1.3: copy/register
mmorph-1.1.2: download             
mmorph-1.1.2: configure    
mmorph-1.1.2: build        
mmorph-1.1.2: copy/register
lucid-2.9.10: download     
lucid-2.9.10: configure    
lucid-2.9.10: build        
lucid-2.9.10: copy/register
lucid-extras-0.1.0.0: configure (lib)
lucid-extras-0.1.0.0: build (lib)  
lucid-extras-0.1.0.0: copy/register
proto-lens-0.2.2.0: configure      
proto-lens-0.2.2.0: build        
proto-lens-0.2.2.0: copy/register
proto-lens-descriptors-0.2.2.0: configure     
proto-lens-descriptors-0.2.2.0: build         
proto-lens-descriptors-0.2.2.0: copy/register 
proto-lens-protoc-0.2.2.3: configure          
proto-lens-protoc-0.2.2.3: build         
proto-lens-protoc-0.2.2.3: copy/register 
proto-lens-protobuf-types-0.2.2.0: configure     
proto-lens-protobuf-types-0.2.2.0: build         
proto-lens-protobuf-types-0.2.2.0: copy/register 
tagged-0.8.5: download                           
tagged-0.8.5: configure     
tagged-0.8.5: build         
tagged-0.8.5: copy/register 
tagsoup-0.14.6: download      
tagsoup-0.14.6: configure     
tagsoup-0.14.6: build         
tagsoup-0.14.6: copy/register 
tensorflow-proto-0.1.0.0: configure (lib)
tensorflow-proto-0.1.0.0: build (lib)   
tensorflow-proto-0.1.0.0: copy/register 
tensorflow-0.1.0.2: configure (lib)     
tensorflow-0.1.0.2: build (lib)         
tensorflow-0.1.0.2: copy/register 
tensorflow-opgen-0.1.0.0: configure (lib)
tensorflow-opgen-0.1.0.0: build (lib)   
tensorflow-opgen-0.1.0.0: copy/register 
tensorflow-core-ops-0.1.0.0: configure (lib)
tensorflow-core-ops-0.1.0.0: build (lib)   
tensorflow-core-ops-0.1.0.0: copy/register 
tensorflow-ops-0.1.0.0: configure (lib)    
tensorflow-ops-0.1.0.0: build (lib)        
tensorflow-ops-0.1.0.0: copy/register 
th-abstraction-0.2.6.0: download      
th-abstraction-0.2.6.0: configure     
th-abstraction-0.2.6.0: build         
th-abstraction-0.2.6.0: copy/register 
time-locale-compat-0.1.1.4: download      
time-locale-compat-0.1.1.4: configure     
time-locale-compat-0.1.1.4: build         
time-locale-compat-0.1.1.4: copy/register 
uniplate-1.6.12: download                 
uniplate-1.6.12: configure     
uniplate-1.6.12: build         
uniplate-1.6.12: copy/register 
utf8-string-1.0.1.1: download      
utf8-string-1.0.1.1: configure     
utf8-string-1.0.1.1: build         
utf8-string-1.0.1.1: copy/register 
uuid-types-1.0.3: download         
uuid-types-1.0.3: configure     
uuid-types-1.0.3: build         
uuid-types-1.0.3: copy/register 
aeson-1.2.4.0: download         
aeson-1.2.4.0: configure     
aeson-1.2.4.0: build         
aeson-1.2.4.0: copy/register 
plotlyhs-0.2: configure (lib)
plotlyhs-0.2: build (lib)   
plotlyhs-0.2: copy/register 
xss-sanitize-0.3.5.7: download      
xss-sanitize-0.3.5.7: configure     
xss-sanitize-0.3.5.7: build         
xss-sanitize-0.3.5.7: copy/register 
cheapskate-0.1.1: download          
cheapskate-0.1.1: configure     
cheapskate-0.1.1: build         
cheapskate-0.1.1: copy/register 
inliterate-0.1.0: configure (lib + exe)
inliterate-0.1.0: build (lib + exe)
inliterate-0.1.0: copy/register 
Building all executables for `haskellDoTfPlay' once. After a successful build of all of them, only specified executables will be rebuilt.
haskellDoTfPlay-0.1.0.0: configure (exe)
Configuring haskellDoTfPlay-0.1.0.0... 
haskellDoTfPlay-0.1.0.0: build (exe)   
Preprocessing executable 'run-test' for haskellDoTfPlay-0.1.0.0..
Building executable 'run-test' for haskellDoTfPlay-0.1.0.0..
[1 of 2] Compiling Main             ( src/Main.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/run-test/run-test-tmp/Main.o )
[2 of 2] Compiling Paths_haskellDoTfPlay ( .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/run-test/autogen/Paths_haskellDoTfPlay.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/run-test/run-test-tmp/Paths_haskellDoTfPlay.o )
Linking .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/run-test/run-test ...
haskellDoTfPlay-0.1.0.0: copy/register 
Installing executable run-test in /home/vincent/worksapce/haskellDoTfPlay/.stack-work/install/x86_64-linux-nix/lts-11.9/8.2.2/bin
Progress 30/31: haskellDoTfPlay-0.1.0.0
vertexcite commented 6 years ago

@vincent-hui I've tried to use nix to handle the native dependencies via stack, so if you pull the latest version and use

stack --nix build && stack --nix exec run-test > demo.html && open demo.html

It should work (but I haven't thoroughly tested it yet, you would be helping test it ;-)

vincent-hui commented 6 years ago

Sorry for being late. I tested the latest code on master branch. I got the following error.

vincent@vincent-VirtualBox:~/worksapce/haskellDoTfPlay$ stack --nix build && stack --nix exec run-test > demo.html && open demo.html
inliterate-0.1.0: unregistering (local file changes: /nix/store/f7br0zvsyclsb9sc0fgpg2ss03aih75b-glibc-2.27-dev/include/stdc-predef.h /nix/store/sq7d7...)
inliterate-0.1.0: configure (lib + exe)
inliterate-0.1.0: build (lib + exe)
inliterate-0.1.0: copy/register
haskellDoTfPlay-0.1.0.0: configure (exe)
Configuring haskellDoTfPlay-0.1.0.0...
haskellDoTfPlay-0.1.0.0: build (exe) 
Preprocessing executable 'run-test' for haskellDoTfPlay-0.1.0.0..
Building executable 'run-test' for haskellDoTfPlay-0.1.0.0..
Linking .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/run-test/run-test ...
haskellDoTfPlay-0.1.0.0: copy/register
Installing executable run-test in /home/vincent/worksapce/haskellDoTfPlay/.stack-work/install/x86_64-linux-nix/lts-11.9/8.2.2/bin
Progress 1/2: haskellDoTfPlay-0.1.0.0
2018-09-25 14:41:12.372174: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2
Couldn't get a file descriptor referring to the console
vertexcite commented 6 years ago

@vincent-hui Looks like it's basically working. $ stack --nix build && stack --nix exec run-test > demo.html looks like it succeeded, but open demo.html seems to have failed due to not being able to open a browser. Since demo.html is probably still there, try just open it from your web browser.

vincent-hui commented 6 years ago

yes, you are right. I can open demo.html from my web browser. Thank a lot