Open AbhimanyuAryan opened 1 year ago
playwright package should be here after installation with pyimport_conda
/Users/abhi/.julia/conda/3/lib/python3.10/site-packages
@AbhimanyuAryan Why don't you use Conda.jl?
using Conda
Conda.add("playwright", channel = "microsoft")
You might need to run Conda.update()
to update your Julia conda registry?
@stevengj don't know what wrong. Nothing suggested so far works. The logs are not helpful. Can't seem to figure out the problem :(
julia> Conda.update()
[ Info: Running `conda update -y --all conda` in root environment
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
julia> pyimport_conda("playwright", "playwright", "microsoft")
[ Info: Installing playwright via the Conda playwright package...
[ Info: Running `conda config --add channels microsoft --file /Users/abhi/.julia/conda/3/condarc-julia.yml --force` in root environment
Warning: 'microsoft' already in 'channels' list, moving to the top
[ Info: Running `conda install -y playwright` in root environment
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- playwright
Current channels:
- https://conda.anaconda.org/microsoft/osx-arm64
- https://conda.anaconda.org/microsoft/noarch
- https://conda.anaconda.org/conda-forge/osx-arm64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/osx-arm64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-arm64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
ERROR: failed process: Process(setenv(`/Users/abhi/.julia/conda/3/bin/conda install -y playwright`,["_CE_M=", "LSCOLORS=Gxfxcxdxbxegedabagacad", "PATH=/Users/abhi/.local/share/fig/plugins/git-open:/Users/abhi/.rbenv/shims:/Users/abhi/miniconda3/condabin:/Users/abhi/.nvm/versions/node/v16.15.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Users/abhi/.cargo/bin:/Users/abhi/.fig/bin:/Users/abhi/.local/bin", "FIG_HOSTNAME=Abhimanyus-MacBook-Air.local", "MANPATH=/Users/abhi/.nvm/versions/node/v16.15.0/share/man:/opt/homebrew/share/man::", "STARSHIP_SESSION_KEY=3181430992982711", "ITERM_PROFILE=Default", "NVM_CD_FLAGS=-q", "USER=abhi", "JULIA_EDITOR=vim" … "LC_FIG_SET_PARENT=a4726391-c3cc-4250-bd66-ed01bfe92ae3", "ZSH=/Users/abhi/.oh-my-zsh", "COMMAND_MODE=unix2003", "FIG_SET_PARENT=a4726391-c3cc-4250-bd66-ed01bfe92ae3", "PWD=/Users/abhi/.julia/dev/Playwright", "TERM_PROGRAM=iTerm.app", "NVM_INC=/Users/abhi/.nvm/versions/node/v16.15.0/include/node", "CONDA_PREFIX=/Users/abhi/.julia/conda/3", "TERM_SESSION_ID=w0t0p0:C0AF54D3-0FCB-4AE6-B131-2377A7205390", "FIG_SET_PARENT_CHECK=1"]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
@ ./process.jl:565 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base ./process.jl:480
[3] run
@ ./process.jl:477 [inlined]
[4] runconda(args::Cmd, env::String)
@ Conda ~/.julia/packages/Conda/x2UxR/src/Conda.jl:128
[5] add(pkg::String, env::String; channel::String)
@ Conda ~/.julia/packages/Conda/x2UxR/src/Conda.jl:222
[6] add (repeats 2 times)
@ ~/.julia/packages/Conda/x2UxR/src/Conda.jl:220 [inlined]
[7] pyimport_conda(modulename::String, condapkg::String, channel::String)
@ PyCall ~/.julia/packages/PyCall/ygXW2/src/PyCall.jl:721
[8] top-level scope
@ REPL[6]:1
caused by: PyError (PyImport_ImportModule
The Python package playwright could not be imported by pyimport. Usually this means
that you did not install playwright in the Python version being used by PyCall.
PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the playwright module, you can
use `pyimport_conda("playwright", PKG)`, where PKG is the Anaconda
package that contains the module playwright, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).
Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'playwright'")
Stacktrace:
[1] pyimport(name::String)
@ PyCall ~/.julia/packages/PyCall/ygXW2/src/PyCall.jl:558
[2] pyimport_conda(modulename::String, condapkg::String, channel::String)
@ PyCall ~/.julia/packages/PyCall/ygXW2/src/PyCall.jl:716
[3] top-level scope
@ REPL[6]:1
using Conda Conda.add("playwright", channel = "microsoft")
have you tried it on your machine? Does it work?
julia> Conda.add("playwright", channel = "microsoft")
[ Info: Running `conda install -y -c microsoft playwright` in root environment
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- playwright
Current channels:
- https://conda.anaconda.org/microsoft/osx-arm64
- https://conda.anaconda.org/microsoft/noarch
- https://conda.anaconda.org/conda-forge/osx-arm64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/osx-arm64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-arm64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
ERROR: failed process: Process(setenv(`/Users/abhi/.julia/conda/3/bin/conda install -y -c microsoft playwright`,["_CE_M=", "LSCOLORS=Gxfxcxdxbxegedabagacad", "PATH=/Users/abhi/.local/share/fig/plugins/git-open:/Users/abhi/.rbenv/shims:/Users/abhi/miniconda3/condabin:/Users/abhi/.nvm/versions/node/v16.15.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Users/abhi/.cargo/bin:/Users/abhi/.fig/bin:/Users/abhi/.local/bin", "FIG_HOSTNAME=Abhimanyus-MacBook-Air.local", "MANPATH=/Users/abhi/.nvm/versions/node/v16.15.0/share/man:/opt/homebrew/share/man::", "STARSHIP_SESSION_KEY=3181430992982711", "ITERM_PROFILE=Default", "NVM_CD_FLAGS=-q", "USER=abhi", "JULIA_EDITOR=vim" … "LC_FIG_SET_PARENT=a4726391-c3cc-4250-bd66-ed01bfe92ae3", "ZSH=/Users/abhi/.oh-my-zsh", "COMMAND_MODE=unix2003", "FIG_SET_PARENT=a4726391-c3cc-4250-bd66-ed01bfe92ae3", "PWD=/Users/abhi/.julia/dev/Playwright", "TERM_PROGRAM=iTerm.app", "NVM_INC=/Users/abhi/.nvm/versions/node/v16.15.0/include/node", "CONDA_PREFIX=/Users/abhi/.julia/conda/3", "TERM_SESSION_ID=w0t0p0:C0AF54D3-0FCB-4AE6-B131-2377A7205390", "FIG_SET_PARENT_CHECK=1"]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
@ ./process.jl:565 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base ./process.jl:480
[3] run
@ ./process.jl:477 [inlined]
[4] runconda(args::Cmd, env::String)
@ Conda ~/.julia/packages/Conda/x2UxR/src/Conda.jl:128
[5] add(pkg::String, env::String; channel::String)
@ Conda ~/.julia/packages/Conda/x2UxR/src/Conda.jl:222
[6] top-level scope
@ REPL[7]:1
I even deleted ~/.julia/conda
and started fresh. Same issue :(
wow it worked on windows but doesn't work on macbook m1
julia> Pkg.build("PyCall")
Building Conda ─→ `C:\Users\aryan\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\6e47d11ea2776bc5627421d59cdcc1296c058071\build.log`
Building PyCall → `C:\Users\aryan\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\53b8b07b721b77144a0fbbbc2675222ebf40a02d\build.log`
julia> using PyCall
[ Info: Precompiling PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0]
julia> pyimport_conda("playwright", "playwright", "microsoft")
[ Info: Installing playwright via the Conda playwright package...
[ Info: Running `conda config --add channels microsoft --file 'C:\Users\aryan\.julia\conda\3\condarc-julia.yml' --force` in root environment
[ Info: Running `conda install -y playwright` in root environment
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\aryan\.julia\conda\3
added / updated specs:
- playwright
The following packages will be downloaded:
package | build
---------------------------|-----------------
greenlet-2.0.1 | py310h00ffb61_0 170 KB conda-forge
playwright-v1.29.1 | py310_0 24.4 MB microsoft
pyee-9.0.4 | pyhd8ed1ab_0 16 KB conda-forge
typing_extensions-4.4.0 | pyha770c72_0 29 KB conda-forge
------------------------------------------------------------
Total: 24.6 MB
The following NEW packages will be INSTALLED:
greenlet conda-forge/win-64::greenlet-2.0.1-py310h00ffb61_0
playwright microsoft/win-64::playwright-v1.29.1-py310_0
pyee conda-forge/noarch::pyee-9.0.4-pyhd8ed1ab_0
typing_extensions conda-forge/noarch::typing_extensions-4.4.0-pyha770c72_0
Downloading and Extracting Packages
playwright-v1.29.1 | 24.4 MB | | 0%
typing_extensions-4. | 29 KB | ############################## | 100%
greenlet-2.0.1 | 170 KB | ############################## | 100%
pyee-9.0.4 | 16 KB | ############################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
PyObject <module 'playwright' from 'C:\\Users\\aryan\\.julia\\conda\\3\\lib\\site-packages\\playwright\\__init__.py'>
@hhaensel actually it works as intended now
julia> playwright.sync_api
PyObject <module 'playwright.sync_api' from 'C:\\Users\\aryan\\.julia\\conda\\3\\lib\\site-packages\\playwright\\sync_api\\__init__.py'>
now the next step is somehow activating conda env environment location: C:\Users\aryan\.julia\conda\3
and installing web drivers $ playwright install
https://playwright.dev/python/docs/intro
and mentioned in this issue: https://github.com/JuliaPy/PyCall.jl/issues/1018
that should get everything needed and I can start writing the wrapper
also @hhaensel the answer to your question. Why not use Conda.add
I don't want to use Conda as deps. I want to do it like how Pandas.jl do it. The only deps I want is PyCall
something like below
copy!(np, pyimport_conda(numpy, numpy)) copy!(pandas, pyimport_conda(pandas, pandas))
Fine for me, just thought you might getting around the issue or receive different error messages. Concerning deps, Conda.jl is in the deps of PyCall, so I think, the price of using Conda is not really high.
yes actually pyimport_conda
calls conda.add()
so if pyimport_conda
is not working it's because of that https://github.com/JuliaPy/PyCall.jl/blob/94a77bf8d0af8de1cbed32447051908b02b4d360/src/PyCall.jl#L721-L722
I am closing this. Since it's machine specific. Maybe I need to properly debug it on m1
I also experience the same issue, from what I have seen, it looks like the package specifies the libpython architecture
dlopen(path/miniconda3/envs/Artemis/lib/libpython3.9.dylib)
==> ErrorException("could not load library
\"path/miniconda3/envs/Artemis/lib/libpython3.9.dylib\"\ndlopen(path/miniconda3/envs/Artemis/lib/libpython3.9.dylib, 0x0009): tried: '/Users/zhuyuchen/miniconda3/envs/Artemis/lib/libpython3.9.dylib'
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')),
'path/miniconda3/envs/Artemis/lib/libpython3.9.dylib'
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))")
If you experience the same issue, the problem could be solved by using a julia version which runs natively on ARM.
juliaup add 1.7.1~aarch64 # julia supports arm natively after 1.7.0
julia +1.7.1~aarch64 # activate the specific julia version
with
python conda
I am able to install playwright using this commandbut when I try to do that with PyCall. It doesn't work and not able to detect package in channel
How can I fix this?