cctbx / cctbx_project

Computational Crystallography Toolbox
https://cci.lbl.gov/docs/cctbx
Other
218 stars 116 forks source link

build a development version on Windows 11, and use it on Visual Studio 2022 by C++ #997

Open Thomas-yunhui opened 3 months ago

Thomas-yunhui commented 3 months ago

I would appreciate it if you could help me! I follow the instructions in https://github.com/cctbx/cctbx_project to build a development version. But there are some errors that occur when I run the command python bootstrap.py --use-conda. I try it on Windows 11 and use it on Visual Studio 2022. here are some error during installation. also, I want to know how to use cctbx onVisual Studio 2022.

PS C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build> D:\Software\anaconda3\python.exe .\bootstrap.py --use-conda Performing actions: hot update base build Installing base packages using: D:\Software\anaconda3\python.exe modules\cctbx_project\libtbx\auto_build\install_conda.py --builder=cctbx --install_conda --python=37 ===== Running in .: deleting dist, tests, tmp

C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build>((ROBOCOPY empty dist /MIR /COPYALL 1>nul ) & rmdir /S /Q dist\ & ) 系统找不到指定的文件。

C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build>((ROBOCOPY empty tests /MIR /COPYALL 1>nul ) & rmdir /S /Q tests\ & ) 系统找不到指定的文件。

C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build>((ROBOCOPY empty tmp /MIR /COPYALL 1>nul ) & rmdir /S /Q tmp\ & ) 系统找不到指定的文件。 ===== Running in modules\ccp4io_adaptbx: git pull --rebase Already up to date. ===== Running in modules\dxtbx: git pull --rebase Already up to date. ===== Running in modules\dxtbx: git remote set-url origin https://github.com/dials/dxtbx.git ===== Running in modules\dxtbx: git fetch origin ===== Running in modules\dxtbx: git checkout dials-3.5 Already on 'dials-3.5' Your branch is up to date with 'origin/dials-3.5'. ===== Running in modules\dxtbx: git branch --set-upstream-to=origin/dials-3.5 dials-3.5 branch 'dials-3.5' set up to track 'origin/dials-3.5'. WARNING: Can not update existing git repository! You are not on a branch. This may be legitimate when run eg. via Jenkins, but be aware that you cannot commit any changes ===== Running in modules\cbflib: git pull --rebase Already up to date. ===== Running in modules\boost: git pull --rebase Already up to date. ===== Running in modules\annlib_adaptbx: git pull --rebase Already up to date. ===== Running in modules\clipper: git pull --rebase Already up to date. ===== Running in modules\annlib: git pull --rebase Already up to date. ===== Running in modules\reduce: git pull --rebase Already up to date. ===== Running in modules\cctbx_project: git pull --rebase Already up to date. ===== Running in modules\cctbx_project: D:\Software\anaconda3\python.exe libtbx\version.py Writing files containing version information for cctbx_project

Wrote C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build\modules\cctbx_project\libtbx....\cctbx_project\cctbx_version.txt Wrote C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build\modules\cctbx_project\libtbx....\cctbx_project\cctbx_version.h Wrote C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build\modules\cctbx_project\libtbx....\cctbx_project\setup.py

===== Running in modules\tntbx: git pull --rebase Already up to date. ===== Running in modules\gui_resources: git pull --rebase Already up to date. ===== Running in modules\ccp4io: git pull --rebase Already up to date.

removing .pyc files in C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build\modules, walk? True removed 17 files ===== Running in .: base Base conda installation: D:\Software\anaconda3 The environment is newer than the environment file. Skipping update. ===== Running in build: run configure.py Traceback (most recent call last): File "..\modules\cctbx_project\libtbx\configure.py", line 34, in if not run(): File "..\modules\cctbx_project\libtbx\configure.py", line 29, in run libtbx.env_config.cold_start(sys.argv) File "C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build\modules\cctbx_project\libtbx\env_config.py", line 3071, in cold_start env = environment(build_path=build_path) File "C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build\modules\cctbx_project\libtbx\env_config.py", line 455, in init self.manage_python_version_major_minor() File "C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build\modules\cctbx_project\libtbx\env_config.py", line 508, in manage_python_version_major_minor self.raise_python_version_incompatible(prev_pvmm=prev_pvmm) File "C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build\modules\cctbx_project\libtbx\env_config.py", line 484, in raise_python_version_incompatible

Thomas-yunhui commented 3 months ago

I want use cctbx on VS by C++, I'm not comfortable with python code habits, I'm not comfortable with python code habits, is there a cctbx version that can be used with just #include

bkpoon commented 3 months ago

It looks like you're switching from Python 2 to Python 3. You can try completely deleting your build directory and run bootstrap.py again. To see how we build on Visual Studio, you can look at our CI build in these lines from cctbx_project/.azure-pipelines/conda-win.yml

  - script: |
      cd $(Pipeline.Workspace)

      if exist "C:\Program Files (x86)\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
        call "C:\Program Files (x86)\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
      )
      if exist "C:\Program Files\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
        call "C:\Program Files\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
      )
      call %CONDA%\condabin\activate.bat %PYTHON_VERSION%
      python bootstrap.py build ^
        --builder=cctbx ^
        --use-conda=%CONDA_PREFIX% ^
        --nproc=4

We set up the Visual Studio compiler (either 2019 or 2022) with vcvarsall.bat and then run bootstrap.py.

If you are writing a separate program, you can write a regular C/C++ program with our includes and linking against our libraries.

Thomas-yunhui commented 2 months ago

It looks like you're switching from Python 2 to Python 3. You can try completely deleting your build directory and run bootstrap.py again. To see how we build on Visual Studio, you can look at our CI build in these lines from cctbx_project/.azure-pipelines/conda-win.yml

  - script: |
      cd $(Pipeline.Workspace)

      if exist "C:\Program Files (x86)\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
        call "C:\Program Files (x86)\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
      )
      if exist "C:\Program Files\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
        call "C:\Program Files\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
      )
      call %CONDA%\condabin\activate.bat %PYTHON_VERSION%
      python bootstrap.py build ^
        --builder=cctbx ^
        --use-conda=%CONDA_PREFIX% ^
        --nproc=4

We set up the Visual Studio compiler (either 2019 or 2022) with vcvarsall.bat and then run bootstrap.py.

If you are writing a separate program, you can write a regular C/C++ program with our includes and linking against our libraries.

Thank you very much for your answer, the installation of C++ package is too complicated for me, I hope you can provide a detailed manual for installing C++ package under windows and using VS, the manual may be as detailed as possible and explain the role of each step, so as to facilitate the installation of users. I have begun to adapt to the habit of using python, and the use of python packages is very convenient. Because I want to package my code for daily calls, I believe I will encounter many difficulties later, and I still need your advice. I sincerely appreciate your help!

Thomas-yunhui commented 2 months ago

It looks like you're switching from Python 2 to Python 3. You can try completely deleting your build directory and run bootstrap.py again. To see how we build on Visual Studio, you can look at our CI build in these lines from cctbx_project/.azure-pipelines/conda-win.yml

  - script: |
      cd $(Pipeline.Workspace)

      if exist "C:\Program Files (x86)\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
        call "C:\Program Files (x86)\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
      )
      if exist "C:\Program Files\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
        call "C:\Program Files\Microsoft Visual Studio\${{ parameters.vs }}\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
      )
      call %CONDA%\condabin\activate.bat %PYTHON_VERSION%
      python bootstrap.py build ^
        --builder=cctbx ^
        --use-conda=%CONDA_PREFIX% ^
        --nproc=4

We set up the Visual Studio compiler (either 2019 or 2022) with vcvarsall.bat and then run bootstrap.py.

If you are writing a separate program, you can write a regular C/C++ program with our includes and linking against our libraries.

(cctbx_env) PS C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build> D:\Software\anaconda3\python.exe .\bootstrap.py --use-conda Performing actions: hot update base build Installing base packages using: D:\Software\anaconda3\python.exe modules\cctbx_project\libtbx\auto_build\install_conda.py --builder=cctbx --install_conda --python=37 ===== Running in .: deleting dist, tests, tmp

C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build>((ROBOCOPY empty dist /MIR /COPYALL 1>nul ) & rmdir /S /Q dist\ & ) 系统找不到指定的文件。

C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build>((ROBOCOPY empty tests /MIR /COPYALL 1>nul ) & rmdir /S /Q tests\ & ) 系统找不到指定的文件。

C:\Users\DELL\source\repos\cctbx_project-master\libtbx\auto_build>((ROBOCOPY empty tmp /MIR /COPYALL 1>nul ) & rmdir /S /Q tmp\ & ) 系统找不到指定的文件。 ===== Running in modules\annlib_adaptbx: git pull --rebase Already up to date. ===== Running in modules\gui_resources: git pull --rebase Already up to date. ===== Running in modules\tntbx: git pull --rebase Already up to date. ===== Running in modules\annlib: git pull --rebase Already up to date. WARNING: Can not update existing git repository! You are not on a branch. This may be legitimate when run eg. via Jenkins, but be aware that you cannot commit any changes ===== Running in modules\clipper: git pull --rebase Already up to date. ===== Running in modules\cctbx_project: git pull --rebase remote: Enumerating objects: 119, done. remote: Counting objects: 100% (119/119), done. remote: Compressing objects: 100% (63/63), done. remote: Total 119 (delta 71), reused 102 (delta 56), pack-reused 0 Receiving objects: 100% (119/119), 134.41 KiB | 211.00 KiB/s, done. Resolving deltas: 100% (71/71), completed with 16 local objects. From https://github.com/cctbx/cctbx_project c779886e73..2d12ea10c8 master -> origin/master d8c84e138e..35866ea670 mpisafe_ensemble_refinement -> origin/mpisafe_ensemble_refinement

I still want to use the C++ version of cctbx, python does not have a clear data structure, the installation according to your method still failed, it seems that some files about SCons reported errors, please give me some guidance. Also, I was wondering if there is a community with cctbx that can discuss issues? Or where is there enough code related to the cctbx library that I can understand the data structure and how each function is used?