Skip to content

Commit

Permalink
Disable latest networkx versions (for now) on installation
Browse files Browse the repository at this point in the history
- Causes errors loading KQC through KLayout GUI
- Added --force-package-reinstall argument to force dependency
  installation to certain versions
- Mentioned the argument in docs
- Also added a note in docs about incompatible XSection version
  • Loading branch information
qpavsmi committed Nov 6, 2023
1 parent 7e26606 commit 49b4513
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions docs/developer/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ pull`` just run :git_url:`setup_within_klayout.py` again. This will take care of
KQCircuit's Python dependencies and installing new ones, as needed. Running KLayout will similarly
update KQCircuits' dependencies in its own Python environment.

If the above didn't work (usually in case of downgrading dependencies), there is an alternative way.
If you see warnings displaying
``WARNING: Target directory xyz already exists. Specify --upgrade to force replacement.``,
this usually indicates that KQCircuits's Python dependencies were not properly upgraded (or downgraded).
In that case run the following:

python3 setup_within_klayout.py --force-package-reinstall

.. note::
If a new version of KQCircuits has stopped using a certain Python dependency that will **not**
be removed automatically. The user has to remove that manually if it causes any problem.
Expand Down
7 changes: 7 additions & 0 deletions docs/user_guide/xsection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ generation for simulation files.
An example of using XSection tool to produce cross-section simulation files is
demonstrated in :git_url:`klayout_package/python/scripts/simulations/waveguides_sim_xsection.py`

.. note::
XSection 1.7 does not work immediately after package install due to the improvement
to backwards compatibility with older Ruby versions. To mitigate the issue,
you need to make a change in the XSection code. From you KLayout environment directory,
open ``KLayout/salt/xsetion/ruby/xsection.rb`` file in editor and change line 200
from ``pts << [[[ p1, p2 ]]]`` to ``pts << [[ p1, p2 ]]``

Process files (.xs)
-------------------

Expand Down
6 changes: 3 additions & 3 deletions klayout_package/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def get_version_and_cmdclass(package_name):
# in elmer_export.py and gmsh_helpers.py, consider adding if more features are needed.
],
extras_require={
"docs": ["sphinx~=4.4", "sphinx-rtd-theme~=0.4", "networkx>=2.7", "matplotlib>=3.5.1"],
"docs": ["sphinx~=4.4", "sphinx-rtd-theme~=0.4", "networkx>=2.7,<3.2", "matplotlib>=3.5.1"],
"tests": ["pytest>=6.0.2", "pytest-cov~=2.8", "pytest-xdist>=2.1", "tox>=3.18", "pylint==2.9",
"networkx>=2.7", "matplotlib>=3.5.1"],
"networkx>=2.7,<3.2", "matplotlib>=3.5.1"],
"notebooks": ["jupyter~=1.0.0", "klayout>=0.28"],
"graphs": ["networkx>=3.0", "matplotlib>=3.6.3"],
"graphs": ["networkx>=3.0,<3.2", "matplotlib>=3.6.3"],
"simulations": ["gmsh>=4.11.1", "pandas>=1.5.3"],
},
entry_points={
Expand Down
2 changes: 1 addition & 1 deletion requirements_within_klayout_unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ numpy>=1.16
scipy>=1.2
Autologging==1.3.2
tqdm==4.61
networkx>=2.7
networkx>=2.7,<3.2
2 changes: 1 addition & 1 deletion requirements_within_klayout_windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

Autologging==1.3.2
tqdm==4.61
networkx>=2.7
networkx>=2.7,<3.2
4 changes: 4 additions & 0 deletions setup_within_klayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def get_klayout_packages_path(path_start):

parser = argparse.ArgumentParser(description='KQC setup within klayout')
parser.add_argument('--unlink', action="store_true", help='remove links')
parser.add_argument('--force-package-reinstall', action="store_true",
help='force reinstalling packages that KQCircuits depends on')
args = parser.parse_args()

configdir = klayout_configdir(kqc_root_path)
Expand Down Expand Up @@ -89,6 +91,8 @@ def get_klayout_packages_path(path_start):
else:
raise SystemError("Unsupported operating system.")

if args.force_package_reinstall:
pip_args += " --upgrade"
print(f'Required packages will be installed in "{target_dir}".')
os.system(f"pip install -r {pip_args}")
print("Finished setting up KQC.")
Expand Down

0 comments on commit 49b4513

Please sign in to comment.