Remote docker interpreter missing packages

I am adding a remote python interpreter on docker. I use “Add Interpreter→On Docker→Pull or use existing” and then everything seems to work fine. I select the system interpreter on path dolfinx-env/bin/python3. For comparison, I run in system terminal docker run -ti dolfinx/dolfinx:stable. whereis python shows the same path as the one in Pycharm. When I run python -m pip list  in the system console I can see a list of packages with fenics-dolfinx and gmsh included. In Pycharm, these two packages are missing. All the other packages are the same with the same versions. I use Ubuntu 22 and Pycharm 2024.3.3.
The pip list output from the terminal-created container and screenshot from Pycharm:
 

Package           Version
----------------- -----------
asttokens         2.4.1
cffi              1.17.1
Cython            3.0.11
decorator         5.1.1
executing         2.1.0
fenics-basix      0.9.0
fenics-dolfinx    0.9.0
fenics-ffcx       0.9.0
fenics-ufl        2024.2.0
gmsh              4.13.1.dev1
ipython           8.28.0
jedi              0.19.1
matplotlib-inline 0.1.7
mpi4py            4.0.0
nanobind          2.2.0
numpy             2.0.2
packaging         24.1
parso             0.8.4
pathspec          0.12.1
petsc4py          3.22.0
pexpect           4.9.0
pip               24.2
prompt_toolkit    3.0.48
ptyprocess        0.7.0
pure_eval         0.2.3
pycparser         2.22
Pygments          2.18.0
scikit_build_core 0.10.7
setuptools        75.1.0
six               1.16.0
slepc4py          3.22.0
stack-data        0.6.3
traitlets         5.14.3
wcwidth           0.2.13
wheel             0.44.0
0
正式评论

Hi there

Could it be the missing packages were installed after the docker container was  up ? (such as in docker entry point or. ascript ?)

If so would it be possible to move the pip install for the missing packages in the dockerfile and let me know if then PyCharm is able to see the packages? 

 

If the issue is not solved by the above would it be possible to send me a dockerfile so I try to replicate the issue ?

Also the IDE Logs would be of help (from Help| Collect Logs and Diagnostics data)

 

Kind regards,

 

Hello,
I think it is possible that the packages are installed after putting up he container. I am pulling a docker image so I don't think I can edit the dockerfile https://hub.docker.com/r/dolfinx/dolfinx/tags. One of the packages (fenics-dolfinx) is also not available through PyPI, it's probably installed from source during container setup.

So, to replicate the issue it's just:
1) Add interpreter → On Docker
2) Pull or use existing: dolfinx/dolfinx:stable
3) Use “System interpreter" from the list

Best Regards,
Szymon

0

Hi Szymon

I had a look a this and it seems the issue is due to the PyCharm missing the paths for those two packages in the interpreter.

The paths for the packages can be added to the python interpreter from Settings | Project: ProjectName | Python Interpreter | Show all | Add

here you can add the missing interpreter paths 

/usr/local/lib 

and /usr/local/dolfinx-real/lib/python3.12/dist-packages

 

You can check those paths by running in the container terminal pip show command 

 

After adding the two paths, please check again in the PyCharm packages and now they should show as expected.

Please let me know if this works for you

Kind regards,

 

0

Dear Ervis,
This seems to be a solution, thank you. I still have one more problem. All packages (standard ones, like os
and the added ones) are shown as unresolved in the editor. Invalidating caches and restarting or “Rescan Available Python Modules and Packages” does not work. Packages do work when I run the script.

Best regards
Szymon

0

Hi Szymon

To keep the two issues separated , would you please raise the new problem as a youtrack case  adding screenshot and IDE Logs (The logs can be provided from Help -> Collect Logs and diagnostics data)

If any further questions regarding the main issue, please let me know.

Kind regards,

0

请先登录再写评论。