diff --git a/src/xfel_calibrate/calibrate.py b/src/xfel_calibrate/calibrate.py
index 00e1318063e002acd1d2cbc597decedcdcfccd37..620e262b21d06827bb674f532f237c0ed599327a 100755
--- a/src/xfel_calibrate/calibrate.py
+++ b/src/xfel_calibrate/calibrate.py
@@ -715,8 +715,8 @@ def run(argv=None):
     # Record installed Python packages for reproducing the environment
     if not args['skip_env_freeze']:
         with (cal_work_dir / 'requirements.txt').open('wb') as f:
-            print('--index-url https://devpi.exfldadev01.desy.de/euxfel/internal',
-                  file=f, flush=True)
+            f.write(b'--index-url https://devpi.exfldadev01.desy.de/euxfel/internal\n')
+            f.flush()
             check_call([python_exe, '-m', 'pip', 'freeze'], stdout=f)
 
     folder = get_par_attr(parms, 'in_folder', 'value', '')