FFTW.jl icon indicating copy to clipboard operation
FFTW.jl copied to clipboard

using FFTW gives error depending on previous module

Open EthanAnderes opened this issue 8 years ago • 12 comments

Any idea why this happens.

If I load OhMyREPL before FFTW I get this error.

              _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1673 (2017-09-06 03:45 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit f32499fa7e (0 days old master)
|__/                   |  x86_64-apple-darwin17.0.0

              _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1673 (2017-09-06 03:45 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit f32499fa7e (0 days old master)
|__/                   |  x86_64-apple-darwin17.0.0

julia> using OhMyREPL

julia> using FFTW
WARNING: error while reinitializing value FFTW:
ErrorException("cannot assign variable DFT.FFTW from module Main")
WARNING: requiring "FFTW" in module "Main" did not define a corresponding module.

... but everything seems to work fine if I load FFTW first.

                _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1673 (2017-09-06 03:45 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit f32499fa7e (0 days old master)
|__/                   |  x86_64-apple-darwin17.0.0

julia> using FFTW

julia> using OhMyREPL

EthanAnderes avatar Sep 06 '17 16:09 EthanAnderes

This is really weird. My best guess is that it has something to do with OhMyREPL calling into the Base REPL loading stuff, which initializes all of the Base names, including the deprecated Base.DFT.FFTW.

ararslan avatar Sep 06 '17 17:09 ararslan

Should I open an issue with OhMyREPL or perhaps just ping KristofferC? At the moment, it's not critical so can also just wait to check back when there is a release candidate for v0.7. Thanks for looking into it.

EthanAnderes avatar Sep 06 '17 18:09 EthanAnderes

I searched FFT, FFTW, DFT things on OhMyREPL but get nothing. Moreover, why OhMyREPL needs FFTW? this seems very weird.

or, maybe there is a conflict on symbols.

appleparan avatar Sep 06 '17 18:09 appleparan

OhMyREPL isn't using FFTW. Like I said, I think it has to do with the Base REPL initialization that's being called, which is likely loading symbols from Base, including the deprecated FFTW bindings. @KristofferC, what's your take on this?

ararslan avatar Sep 06 '17 21:09 ararslan

I'm using staticfloat's docker image and it seems okay with that version.

root@67c40e951d84:/# julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1568 (2017-08-29 23:34 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 881ab49 (7 days old master)
|__/                   |  x86_64-pc-linux-gnu

julia> using OhMyREPL

julia> using FFTW

julia>

appleparan avatar Sep 06 '17 21:09 appleparan

I don't really know why this would happen. The Repl should be orthogonal to the loading of code. Feel free to open an issue though and I can try look at it if a couple of days.

KristofferC avatar Sep 06 '17 22:09 KristofferC

Liams-MBA ~ » julia7
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1675 (2017-09-06 15:48 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 508c9f536c (0 days old master)
|__/                   |  x86_64-apple-darwin13.4.0

julia> using OhMyREPL

julia> using FFTW

julia>

julia>

Even in macOS, it works.

appleparan avatar Sep 06 '17 22:09 appleparan

Ok, so this is really weird. I only get the error when I use tab completion for using OhMyREPL... i.e. type using OhM<tab>, then hit return, then run using FFTW.

$ ~/Software/juliaMaster/julia --startup-file=no
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1712 (2017-09-07 22:16 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit bc12af5e28 (0 days old master)
|__/                   |  x86_64-apple-darwin17.0.0

julia> using OhMyREPL # used tab completion for this line only

julia> using FFTW
WARNING: error while reinitializing value FFTW:
ErrorException("cannot assign variable DFT.FFTW from module Main")
WARNING: requiring "FFTW" in module "Main" did not define a corresponding module.

... but I get no problem if I type the command using OhMyREPL without tab completion.

$ ~/Software/juliaMaster/julia --startup-file=no
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1712 (2017-09-07 22:16 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit bc12af5e28 (0 days old master)
|__/                   |  x86_64-apple-darwin17.0.0

julia> using OhMyREPL # typed this command without tab completion

julia> using FFTW

julia>

One thing to note: I'm on a new Mac with macOS High Sierra Version 10.13 Beta. Here are the versions for the relevant packages.

julia> Pkg.status("FFTW")
 - FFTW                          0.1.0              master

julia> Pkg.status("AbstractFFTs")
 - AbstractFFTs                  0.2.0              master

julia> Pkg.status("OhMyREPL")
 - OhMyREPL                      0.2.7+             master

EthanAnderes avatar Sep 08 '17 16:09 EthanAnderes

It seems it relates to deprecated.jl

It shows using .DFT and tab completion makes some confliction with original module.

I tested with this FFT.jl. It have 3 modules, DSPs, DFTs, and CollectionsS which contents are same as deprecated.jl (just add S to module name). DSP and DFT have using statements on deprecated.jl, but Collections does not. I tested with TAB completion as @EthanAnderes did.

julia> using OhMyREPL

julia> include("FFT.jl")

julia> using CollectionsS

julia> using DSPs
WARNING: using DSPs.deconv in module Main conflicts with an existing identifier.
WARNING: using DSPs.filt! in module Main conflicts with an existing identifier.
WARNING: using DSPs.xcorr in module Main conflicts with an existing identifier.
WARNING: using DSPs.conv in module Main conflicts with an existing identifier.
WARNING: using DSPs.conv2 in module Main conflicts with an existing identifier.
WARNING: using DSPs.filt in module Main conflicts with an existing identifier.

julia> using DFTs
WARNING: using DFTs.ifftshift in module Main conflicts with an existing identifier.
WARNING: using DFTs.irfft in module Main conflicts with an existing identifier.
WARNING: using DFTs.bfft in module Main conflicts with an existing identifier.
WARNING: using DFTs.idct in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_idct in module Main conflicts with an existing identifier.
WARNING: using DFTs.brfft in module Main conflicts with an existing identifier.
WARNING: using DFTs.fftshift in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_bfft! in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_ifft in module Main conflicts with an existing identifier.
WARNING: using DFTs.ifft! in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_rfft in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_irfft in module Main conflicts with an existing identifier.
WARNING: using DFTs.idct! in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_ifft! in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_fft! in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_dct in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_fft in module Main conflicts with an existing identifier.
WARNING: using DFTs.fft! in module Main conflicts with an existing identifier.
WARNING: using DFTs.FFTW in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_bfft in module Main conflicts with an existing identifier.
WARNING: using DFTs.dct in module Main conflicts with an existing identifier.
WARNING: using DFTs.fft in module Main conflicts with an existing identifier.
WARNING: using DFTs.rfft in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_idct! in module Main conflicts with an existing identifier.
WARNING: using DFTs.ifft in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_brfft in module Main conflicts with an existing identifier.
WARNING: using DFTs.plan_dct! in module Main conflicts with an existing identifier.
WARNING: using DFTs.bfft! in module Main conflicts with an existing identifier.
WARNING: using DFTs.dct! in module Main conflicts with an existing identifier.

julia>

As you can see, there are some conflictions but not CollectionsS. I think that using statement makes this error. This is not related to FFTW.jl. However, why TAB completion? what is TAB completion doing?

If u see OhMyREPL.jl 's source code, does LineEdit has a problem or rewrite_with_ANSI? I want to open an issue but have no idea where, Julia.jl or OhMyREPL.jl.

Any thoughts? @ararslan @KristofferC

appleparan avatar Sep 11 '17 11:09 appleparan

I found another situation

root@67c40e951d84:~# julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.1568 (2017-08-29 23:34 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 881ab49 (13 days old master)
|__/                   |  x86_64-pc-linux-gnu

julia> using Base

julia> using FFTW
WARNING: error while reinitializing value FFTW:
ErrorException("cannot assign variable DFT.FFTW from module Main")
WARNING: requiring "FFTW" in module "Main" did not define a corresponding module.

julia>

I used TAB completion for using Base and got same error. It is obviously Julia problem.

appleparan avatar Sep 12 '17 13:09 appleparan

Yay, OMR is innocent!

KristofferC avatar Sep 12 '17 13:09 KristofferC

Probably something in this REPL tab-completion code is binding/evaluating something that it shouldn't?

stevengj avatar Sep 12 '17 15:09 stevengj