Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3.4: Path has no attribute write_bytes #1963

Closed
asottile opened this issue Oct 2, 2020 · 1 comment · Fixed by #1965
Closed

python3.4: Path has no attribute write_bytes #1963

asottile opened this issue Oct 2, 2020 · 1 comment · Fixed by #1965
Labels

Comments

@asottile
Copy link
Contributor

asottile commented Oct 2, 2020

Issue

appears to have regressed in #1924

Environment

Provide at least:

  • OS: linux

  • pip list of the host python where virtualenv is installed:

     appdirs==1.4.4
     distlib==0.3.1
     filelock==3.0.12
     importlib-metadata==1.1.3
     importlib-resources==1.0.2
     pathlib2==2.3.5
     PyYAML==3.10
     scandir==1.10.0
     six==1.15.0
     typing==3.7.4.3
     virtualenv==20.0.32
     zipp==1.2.0

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

root@e8c42617e572:/# virtualenv venv -vvv --with-traceback
106 setup logging to NOTSET [DEBUG report:43]
133 find interpreter for spec PythonSpec(path=/usr/bin/python3) [INFO builtin:44]
133 proposed PythonInfo(spec=CPython3.4.3.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.4.3 (default, Nov 12 2018, 22:25:49) \n[GCC 4.8.4]', encoding_fs_io=ascii-ANSI_X3.4-1968) [INFO builtin:50]
134 accepted PythonInfo(spec=CPython3.4.3.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.4.3 (default, Nov 12 2018, 22:25:49) \n[GCC 4.8.4]', encoding_fs_io=ascii-ANSI_X3.4-1968) [DEBUG builtin:52]
135 filesystem is case-sensitive [DEBUG info:28]
179 create virtual environment via CPython3Posix(dest=/venv, clear=False, global=False) [INFO session:52]
180 create folder /venv/bin [DEBUG _sync:25]
180 create folder /venv/lib/python3.4/site-packages [DEBUG _sync:25]
180 write /venv/pyvenv.cfg [DEBUG pyenv_cfg:34]
180 	home = /usr [DEBUG pyenv_cfg:38]
180 	implementation = CPython [DEBUG pyenv_cfg:38]
181 	version_info = 3.4.3.final.0 [DEBUG pyenv_cfg:38]
181 	virtualenv = 20.0.32 [DEBUG pyenv_cfg:38]
181 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
181 	base-prefix = /usr [DEBUG pyenv_cfg:38]
181 	base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
181 	base-executable = /usr/bin/python3 [DEBUG pyenv_cfg:38]
181 symlink /usr/bin/python3 to /venv/bin/python [DEBUG _sync:44]
182 create virtualenv import hook file /venv/lib/python3.4/site-packages/_virtualenv.pth [DEBUG api:95]
183 create /venv/lib/python3.4/site-packages/_virtualenv.py [DEBUG api:98]
183 ============================== target debug ============================== [DEBUG session:54]
184 debug via /venv/bin/python /usr/local/lib/python3.4/dist-packages/virtualenv/create/debug.py [DEBUG creator:213]
183 {
  "version": "3.4.3 (default, Nov 12 2018, 22:25:49) \n[GCC 4.8.4]",
  "datetime": "<module 'datetime' from '/usr/lib/python3.4/datetime.py'>",
  "site": "<module 'site' from '/usr/lib/python3.4/site.py'>",
  "makefile_filename": "/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu/Makefile",
  "sys": {
    "path": [
      "/usr/lib/python3.4",
      "/usr/lib/python3.4/plat-x86_64-linux-gnu",
      "/usr/lib/python3.4/lib-dynload",
      "/venv/lib/python3.4/site-packages"
    ],
    "fs_encoding": "ascii",
    "io_encoding": "ANSI_X3.4-1968",
    "exec_prefix": "/venv",
    "_base_executable": null,
    "base_prefix": "/usr",
    "base_exec_prefix": "/usr",
    "executable": "/venv/bin/python",
    "real_prefix": null,
    "prefix": "/venv",
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib.PathFinder'>"
    ]
  },
  "os": "<module 'os' from '/usr/lib/python3.4/os.py'>",
  "json": "<module 'json' from '/usr/lib/python3.4/json/__init__.py'>",
  "math": "<module 'math' (built-in)>"
} [DEBUG session:55]
230 add seed packages via FromAppData(download=False, pip=bundle, wheel=bundle, setuptools=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv) [INFO session:59]
233 got embed update of distribution setuptools from /root/.local/share/virtualenv/wheel/3.4/embed/1/setuptools.json [DEBUG via_disk_folder:133]
234 got embed update of distribution pip from /root/.local/share/virtualenv/wheel/3.4/embed/1/pip.json [DEBUG via_disk_folder:133]
234 got embed update of distribution wheel from /root/.local/share/virtualenv/wheel/3.4/embed/1/wheel.json [DEBUG via_disk_folder:133]
238 got embed update of distribution pip from /root/.local/share/virtualenv/wheel/3.4/embed/1/pip.json [DEBUG via_disk_folder:133]
239 got embed update of distribution wheel from /root/.local/share/virtualenv/wheel/3.4/embed/1/wheel.json [DEBUG via_disk_folder:133]
239 got embed update of distribution setuptools from /root/.local/share/virtualenv/wheel/3.4/embed/1/setuptools.json [DEBUG via_disk_folder:133]
239 install pip from wheel /usr/local/lib/python3.4/dist-packages/virtualenv/seed/wheels/embed/pip-19.1.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
240 Attempting to acquire lock 140611254941288 on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/pip-19.1.1-py2.py3-none-any.lock [DEBUG filelock:270]
240 install setuptools from wheel /usr/local/lib/python3.4/dist-packages/virtualenv/seed/wheels/embed/setuptools-43.0.0-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
240 install wheel from wheel /usr/local/lib/python3.4/dist-packages/virtualenv/seed/wheels/embed/wheel-0.33.6-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
240 Lock 140611254941288 acquired on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/pip-19.1.1-py2.py3-none-any.lock [INFO filelock:274]
240 Attempting to acquire lock 140611254942072 on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any.lock [DEBUG filelock:270]
243 Lock 140611254942072 acquired on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any.lock [INFO filelock:274]
241 Attempting to release lock 140611254941288 on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/pip-19.1.1-py2.py3-none-any.lock [DEBUG filelock:315]
240 Attempting to acquire lock 140611254941512 on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/wheel-0.33.6-py2.py3-none-any.lock [DEBUG filelock:270]
243 Attempting to release lock 140611254942072 on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any.lock [DEBUG filelock:315]
243 Lock 140611254941288 released on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/pip-19.1.1-py2.py3-none-any.lock [INFO filelock:318]
244 Lock 140611254942072 released on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any.lock [INFO filelock:318]
244 Lock 140611254941512 acquired on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/wheel-0.33.6-py2.py3-none-any.lock [INFO filelock:274]
244 copy /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any/setuptools-43.0.0.virtualenv to /venv/lib/python3.4/site-packages/setuptools-43.0.0.virtualenv [DEBUG _sync:52]
245 copy directory /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/pip-19.1.1-py2.py3-none-any/pip-19.1.1.dist-info to /venv/lib/python3.4/site-packages/pip-19.1.1.dist-info [DEBUG _sync:52]
245 Attempting to release lock 140611254941512 on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/wheel-0.33.6-py2.py3-none-any.lock [DEBUG filelock:315]
245 Lock 140611254941512 released on /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/wheel-0.33.6-py2.py3-none-any.lock [INFO filelock:318]
246 copy /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/wheel-0.33.6-py2.py3-none-any/wheel-0.33.6.virtualenv to /venv/lib/python3.4/site-packages/wheel-0.33.6.virtualenv [DEBUG _sync:52]
246 copy directory /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any/setuptools-43.0.0.dist-info to /venv/lib/python3.4/site-packages/setuptools-43.0.0.dist-info [DEBUG _sync:52]
247 copy directory /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/wheel-0.33.6-py2.py3-none-any/wheel-0.33.6.dist-info to /venv/lib/python3.4/site-packages/wheel-0.33.6.dist-info [DEBUG _sync:52]
251 copy directory /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/pip-19.1.1-py2.py3-none-any/pip to /venv/lib/python3.4/site-packages/pip [DEBUG _sync:52]
252 copy directory /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/wheel-0.33.6-py2.py3-none-any/wheel to /venv/lib/python3.4/site-packages/wheel [DEBUG _sync:52]
254 copy directory /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any/setuptools to /venv/lib/python3.4/site-packages/setuptools [DEBUG _sync:52]
265 generated console scripts wheel wheel-3.4 wheel3.4 wheel3 [DEBUG base:48]
313 copy /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any/easy_install.py to /venv/lib/python3.4/site-packages/easy_install.py [DEBUG _sync:52]
313 copy directory /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/setuptools-43.0.0-py2.py3-none-any/pkg_resources to /venv/lib/python3.4/site-packages/pkg_resources [DEBUG _sync:52]
327 generated console scripts easy_install3 easy_install easy_install-3.4 easy_install3.4 [DEBUG base:48]
437 copy /root/.local/share/virtualenv/wheel/3.4/image/1/CopyPipInstall/pip-19.1.1-py2.py3-none-any/pip-19.1.1.virtualenv to /venv/lib/python3.4/site-packages/pip-19.1.1.virtualenv [DEBUG _sync:52]
439 generated console scripts pip-3.4 pip3.4 pip3 pip [DEBUG base:48]
440 add activators for PowerShell, Fish, Python, Bash, CShell [INFO session:66]
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 10, in <module>
    sys.exit(run_with_catch())
  File "/usr/local/lib/python3.4/dist-packages/virtualenv/__main__.py", line 62, in run_with_catch
    run(args, options)
  File "/usr/local/lib/python3.4/dist-packages/virtualenv/__main__.py", line 16, in run
    session = cli_run(args, options)
  File "/usr/local/lib/python3.4/dist-packages/virtualenv/run/__init__.py", line 28, in cli_run
    of_session.run()
  File "/usr/local/lib/python3.4/dist-packages/virtualenv/run/session.py", line 48, in run
    self._activate()
  File "/usr/local/lib/python3.4/dist-packages/virtualenv/run/session.py", line 69, in _activate
    activator.generate(self.creator)
  File "/usr/local/lib/python3.4/dist-packages/virtualenv/activation/via_template.py", line 30, in generate
    generated = self._generate(replacements, self.templates(), dest_folder, creator)
  File "/usr/local/lib/python3.4/dist-packages/virtualenv/activation/via_template.py", line 58, in _generate
    dest.write_bytes(text.encode("utf-8"))
AttributeError: 'Path' object has no attribute 'write_bytes'
@asottile asottile added the bug label Oct 2, 2020
andy-maier added a commit to pywbem/nocasedict that referenced this issue Oct 4, 2020
Details:

* The installtest failed on Python 3.4 with latest package levels because
  virtualenv raises AttributeError (see pypa/virtualenv#1963).
  Fixed that by excluding virtualenv 20.0.32. Also, excluded virtualenv 20.0.19 to
  make sure an earlier error where pip did not install on Python 3.4.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
andy-maier added a commit to andy-maier/cookiecutter-python that referenced this issue Oct 4, 2020
…lltest on py34

Details:

* virtualenv raised AttributeError: 'Path' object has no attribute 'write_bytes'
  during 'make installtest' on Python 3.4 since a few days.
  This had already been reported as pypa/virtualenv#1963.
  This change fixes that by excluding virtualenv 20.0.32.
  To avoid an earlier issue where virtualenv did not install pop on Python 3.4,
  virtualenv 20.0.19 was also excluded.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
andy-maier added a commit to andy-maier/cookiecutter-python that referenced this issue Oct 4, 2020
…lltest on py34

Details:

* virtualenv raised AttributeError: 'Path' object has no attribute 'write_bytes'
  during 'make installtest' on Python 3.4 since a few days.
  This had already been reported as pypa/virtualenv#1963.
  This change fixes that by excluding virtualenv 20.0.32.
  To avoid an earlier issue where virtualenv did not install pop on Python 3.4,
  virtualenv 20.0.19 was also excluded.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
andy-maier added a commit to pywbem/nocasedict that referenced this issue Oct 4, 2020
Details:

* The installtest failed on Python 3.4 with latest package levels because
  virtualenv raises AttributeError (see pypa/virtualenv#1963).
  Fixed that by excluding virtualenv 20.0.32. Also, excluded virtualenv 20.0.19 to
  make sure an earlier error where pip did not install on Python 3.4.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
andy-maier added a commit to pywbem/nocaselist that referenced this issue Oct 4, 2020
Details:

* The installtest failed on Python 3.4 with latest package levels because
  virtualenv raises AttributeError (see pypa/virtualenv#1963).
  Fixed that by excluding virtualenv 20.0.32. Also, excluded virtualenv 20.0.19 to
  make sure an earlier error where pip did not install on Python 3.4.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
andy-maier added a commit to pywbem/pywbemtools that referenced this issue Oct 4, 2020
Details:

* On other pywbem projects, the installtest failed on Python 3.4 with latest
  package levels because virtualenv raises AttributeError (see pypa/virtualenv#1963).
  Fixed that preventively by excluding virtualenv 20.0.32.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
andy-maier added a commit to pywbem/nocaselist that referenced this issue Oct 4, 2020
Details:

* The installtest failed on Python 3.4 with latest package levels because
  virtualenv raises AttributeError (see pypa/virtualenv#1963).
  Fixed that by excluding virtualenv 20.0.32. Also, excluded virtualenv 20.0.19 to
  make sure an earlier error where pip did not install on Python 3.4.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
@gaborbernat
Copy link
Contributor

@asottile
fixed it

andy-maier added a commit to pywbem/pywbemtools that referenced this issue Oct 4, 2020
Details:

* On other pywbem projects, the installtest failed on Python 3.4 with latest
  package levels because virtualenv raises AttributeError (see pypa/virtualenv#1963).
  Fixed that preventively by excluding virtualenv 20.0.32.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
andy-maier added a commit to pywbem/pywbemtools that referenced this issue Oct 5, 2020
Details:

* On other pywbem projects, the installtest failed on Python 3.4 with latest
  package levels because virtualenv raises AttributeError (see pypa/virtualenv#1963).
  Fixed that preventively by excluding virtualenv 20.0.32.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
andy-maier added a commit to pywbem/pywbemtools that referenced this issue Oct 5, 2020
Details:

* On other pywbem projects, the installtest failed on Python 3.4 with latest
  package levels because virtualenv raises AttributeError (see pypa/virtualenv#1963).
  Fixed that preventively by excluding virtualenv 20.0.32.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
bmwiedemann referenced this issue in bmwiedemann/openSUSE Oct 29, 2020
https://build.opensuse.org/request/show/840217
by user StevenK + dimstar_suse
- Update to 20.0.33:
  * Fix ``None`` type error in cygwin if POSIX path in dest - by :user:`danyeaw`. (`#1962 <https://github.com/pypa/virtualenv/issues/1962>`_)
  * Fix Python 3.4 incompatibilities (added back to the CI) - by :user:`gaborbernat`. (`#1963 <https://github.com/pypa/virtualenv/issues/1963>`_)
  * For activation scripts always use UNIX line endings (unless it's BATCH shell related) - by :user:`saytosid`. (`#1818 <https://github.com/pypa/virtualenv/issues/1818>`_)
  * Avoid spawning new windows when doing seed package upgrades in the background on Windows - by :user:`gaborbernat`. (`#1928 <https://github.com/pypa/virtualenv/issues/1928>`_)
  * Fix a bug that reading and writing on the same file may cause race on multiple processes. (`#1938 <https://github.com/pypa/virtualenv/is
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants